Hey Philipp, It kind of depends on your use case. One option is to e.g. use a bundle listener to get each bundle. On the bundles themselves you've options to load resources and classes [1]. This might be an option. But as said, depends quite heavily on your use case.
Kind regards, Andreas [1] http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/Bundle.html On Tue, Nov 19, 2013 at 6:20 PM, Philipp Hoenisch < [email protected]> wrote: > Hey guys, > > I'm not sure if this belongs in here or more to the Felix mailing list, > anyway, I'll give it a try: > > versions i use: > karaf: 2.3.2 > felix: 4.0.3 > > I'm trying to find a class which is located in one of the packages without > knowing it's name, however, I do know that it is annotated with a specific > annotation. This class is autogenerated using a maven plugin. > Anyway, what I try to do is to find this class (located in the same bundle) > and create an instance during runtime, aka right after the bundleActivator > was started > > As the package name is known I tried a simple approach aka: > > Thread.currentThread().getContextClassLoader().getResources(PACKAGENAME); > > and then iterate over the the files. > > The problem is that the ClassLoaders work a bit differently in OSGI right? > > Can anyone point me to the right direction how I can find a particular > class? > > thank you in advance, > best regards, > Philipp > > > > -- > View this message in context: > http://karaf.922171.n3.nabble.com/Finding-classes-in-a-Bundle-tp4030368.html > Sent from the Karaf - User mailing list archive at Nabble.com. >
