[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [equinox-dev] getResources()
|
Hi John
That would be a "split-package"
scenario. All bundles that contain the resource /WHATEVER-INF/hi.xml
would need to export the package WHATEVER-INF. Then your bundle would
need to use Require-Bundle to require all bundles that export the WHATEVER-INF
package. This is one way your bundle can see all the /WHATEVER-INF/hi.xml
resources from the different bundles. Another possibility is
to use fragment bundles to add more resources to your bundle but that is
likely not what you want to do.
You could also use the buddy-classloading
features within Equinox. This works well for scenarios where a library
bundle needs access to all the /WHATEVER-INF/hi.xml
resources from the bundles that depend on it. To do this you would
add the following header to your library bundle:
Eclipse-BuddyPolicy: dependent
Any bundles that contain the /WHATEVER-INF/hi.xml
would need to depend on your library bundle, either by using Import-Package
or Require-Bundle.
A completely different approach would
be to search all the bundles installed in the system for the /WHATEVER-INF/hi.xml
resource by using the Bundle.getEntry method. One example of this
approach is the extension registry in eclipse. The extension registry
uses this method to find all the available plugin.xml files that are installed
in the system to contribute extension points and extensions to the registry.
The declarative services runtime also uses this approach to find
all the component xml files. This has many advantages because it
does not force you to depend on the bundles (using Import-Package, Require-Bundle
or Eclipse-BuddyPolicy) and it does not require a classloader to be created
for the bundles you are reading the xml files from.
HTH
Tom
"John Wells"
<jwells@xxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx
06/15/2006 04:02 PM
Please respond to
Equinox development mailing list <equinox-dev@xxxxxxxxxxx> |
|
To
| "Equinox development mailing list"
<equinox-dev@xxxxxxxxxxx>
|
cc
|
|
Subject
| [equinox-dev] getResources() |
|
I have a situation where I need
getResources() to return a list of resources from a specific place found
in different bundles. In a "normal" classloader environment
if I had two jars in the classpath with a resource
/WHATEVER-INF/hi.xml
and I asked the classloader for
the getResources() I would get two items in the enumeration.
However, if those same two things
were bundles, how could I make a third bundle also return two items from
the getResources() call? Do I somehow make both bundles export WHATEVER-INF
(like a package) and then have the third bundle import WHATEVER-INF? I
don't think that will work, since only one of the exported WHATEVER-INF
guys will be chosen.
Anyone have any ideas on how to
accomplish this sort of thing?
John Wells (Aziz)
jwells@bea.comNOSPAM
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries
and affiliated
entities, that may be confidential, proprietary, copyrighted
and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev