Below is my understanding with respect to OSGi.Kindly let me know in case iam not correct in any aspect.
1) OSGi helps us to break the application into modules called Bundles.
2) So, OSGi acts like a local server where in we deploy our bundles in a jar.
3) The Dependencies are to be mentioned in the Manifest file (Just like .classpath file created in eclipse)
4) Bundle Activator is the java class that is created using OSGi API which need to override some method which is automatically when started the server.This is somthing like main method in standalone class (or) doGet() in a servlet which initiates the action
5) Apart from the above we can also configure listeners when a task has to be performed on an event
6) We can also contact other bundles which is similar to Webservices.
Kindly let me know any other benefits/purpose.
Below are my questions
1) Need Real time scenarios/Application where OSGi is used
2) Need the purpose, since am still not able to understand the purpose after going through a lot of stuff
3) Or it is used only for development purpose - If so, why cant we use JUNIT to test the modules.
Just want to make myself very clear to make it Simple Straight
#2: OSGi is just the API; the container in which the bundles run is provided by an implementation such as Apache Felix or Eclipse Equinox.
#4 and #5: Sort of. There are other interesting interfaces you can implement as well, such as BundleListener and ServiceListener. Services are sort of a higher-level API than Bundles.
Q1: OSGi has very little to do with realtime scenarios, just like Java has very little to do with realtime scenarios. Well-known applications that use OSGi are GlassFish and Eclipse.
Q2: You already mentioned modularization. OSGi also offers capabilities like adding/removing code at runtime, using different versions of the same classes within the same JVM, and updating code without stopping the JVM etc. It is a specialized technology that many applications will not need, but it does simplify tasks that require this kind of flexibility. See https://coderanch.com/how-to/java/OSGiLinks for some introductory material.
Q3: It's about deployment, not development.
My honeysuckle is blooming this year! Now to fertilize this tiny ad: