Some doubts related to osgi

I am new to OSGI infrastructure. I browsed websites and read about the OSGI framework. Honestly, I didn’t understand anything. Below are my doubts.

  • OSGi must be modular. Is it possible to achieve modularity through conventional banks?
  • What does it mean that OSGi has a dynamic component model?
  • Bundles can be installed, started, stopped, updated, etc. Why do we want to install packages? Why can't we directly access other normal jars?

I am completely confused. Can someone answer me? If you can give a few examples.

+4
source share
5 answers

I tried to answer the first question on the OSGi blog: http://blog.osgi.org/2013/08/dear-prudence-cant-we-achieve.html

Next week, answer the next question.

+3
source
  • No. JARs are open containers for classes and do not provide runtime encapsulation. See http://www.slideshare.net/bjhargrave/why-osgi
  • Dynamic means that the life cycle of a package can be changed when the VM / OSGi environment is running. That is, you do not need to reboot the system to install / start / stop / update / remove the package.
  • You want to do this in order to manage the package life cycle. No need to use OSGi dynamically. You can simply use it for modularity and services, only installing packages before starting work.
+4
source

My definition of a module is an encapsulation unit (i.e. hides internal details) that communicates with other modules through a contract (i.e. a predefined set of possible interactions). The JAR file is not a module because it does not have any of these properties. There is no encapsulation, all internal implementation details are visible and accessible from the outside. There is no contract, you just put the JAR file in the classpath and hope that it will provide you with the necessary functions.

Dynamic means that OSGi packages (modules) can be installed, updated, or uninstalled at runtime. This can be very useful for updating running systems or for efficiently deploying software on a large network.

Communications must be established because the software must always be installed before using it. JAR files must also be installed! Only the installation tools are slightly different from each other, that is, JAR files are added to the class path, while packages are installed using the install command (this can also be written or called from the API). OSGi gives us much more control over this process.

+4
source

Apart from the aspect of the Bundles as true modules, which was mentioned in all the other answers, there are several other functions that make OSGi extremely powerful:

  • service level allows you to dynamically connect your objects at runtime. In combination with declarative services, you get a very powerful and flexible software model with all the advantages of the IOC .
  • The expander model provides a kind of IOC at a higher level and can create huge benefits for extensibility.
+2
source

It might be useful to read about the implementation of the OSGi specification.

If you used Eclipse, you experienced some of the benefits of OSGi and didn't even know about it.

Here's a great description of the basics of what Equinox is.

http://www.vogella.com/articles/OSGi/article.html

+1
source

All Articles