Hi Im new to OSGi and have played around with Pax Exam for a short while now. Im trying to learn how to implement an annotation driven framework using OSGi.
So I have created this silly little application where I have an api, impl and client bundles. There is also an engine bundle that I want to use as the framework to handle instance creation and proxy services. The engine have a SynchronousBundleListener that listen for new bundles and look for classes with the "Impl" annotation - and register new service provider instances: https://github.com/deephacks/osgi-demo/blob/master/engine/src/main/java/org/deephacks/osgi/engine/Activator.java. Two questions I havent managed to figure out: 1) I get a ClassCastException when casting the service and use it as a regular object with JUnit4TestRunner from my test class: https://github.com/deephacks/osgi-demo/blob/master/client/src/test/java/org/deephacks/osgi/client/PaxTest.java. This seems strange since the Shape class should be common for client and impl. 2) How do I inspect classes use the Reflection API from my framework that isnt suppose to know anything about the api or impl bundles? The only way I could get around this was using Strings like so: "org.deephacks.osgi.Impl".equals(annotation.annotationType().getName() - i.e. loadedClass.isAnnotationPresent(Impl.class) resolves to false. I have published the source code on github: https://github.com/deephacks/osgi-demo Cheers, -Kristoffer _______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
