I have an OSGi package that can also work in a simple Java process. I need to find out if the package is downloaded to the OSGi system or not. How can i do this? If there is no standard OSGi method for this, I will agree to an Eclipse / Equinox based approach.
If you do not have an activator, you can also ask for your kit:
Bundle b = org.osgi.framework.FrameworkUtil.getBundle(MyClass.this);
If it returns null, your class has not been loaded by OSGi.
Add the Bundle-Activator to your MANIFEST.MF. If it is created, your JAR runs in the OSGi container.
You can check if this.getClass () is there. getClassLoader () instanceof org.osgi.framework.BundleReference ", which should be right only if you are running OS4i R4.2.