OSGI(Open Service Gateway Initiative)

OSGI (Open Service Gateway Initiative) It can be regarded as the OSGi Alliance organization; it can also be regarded as a Java-based organization developed by the organization.
a) You can dynamically install, uninstall, start and stop different modules in your application without restarting the container;
b) For a particular module in your application, the container can run multiple versions of that module at the same time;
c) OSGi provides an excellent infrastructure for developing embedded applications, mobile applications, and rich Internet applications (RIA).
One module is responsible for the view layer, another module is responsible for the DAO layer, and a third module is responsible for the data access layer . If we use an OSGi container to manage the cross dependencies between these modules, we can
Under the premise of web application, upgrade the DAO layer from a slower DAO to a faster DAO.


 The OSGI (Open Service Gateway Initiative) Alliance was established in 1999. It is a non-profit international organization that aims to establish an open service specification and establish an open standard for providing services to devices through the network. It is the initiator of the open service gateway. . The initial goal of the OSGI Alliance is to build a basic platform for conducting business on WAN and LAN or devices. The earliest design of OSGI is also for embedded applications, such as set-top boxes, service gateways, mobile phones, automobiles, etc. The main environment for its application . Due to many excellent features of OSGI (dynamically changing system behavior, hot-swappable plug-in architecture, high reusability, high efficiency, etc.), it has been used in many PC application development, so it has gradually become popular among developers. Know and love. Now people's understanding of OSGI is far beyond what its literal and original intentions can explain. It is more accurate to call it a lightweight, loosely coupled, service-oriented application development framework. The development of OSGI has been supported by many enterprises, manufacturers, and open source organizations. The mainstream Java application servers (Oracle's Weblogic, IBM's Websphere and Sun's Glassfish, etc.) have adopted OSGI. OSGi has become a de facto standard for Java modularity. OSGI famous case Eclipse, as a successful IDEproject in the Java industry, used a set of plug-in architecture designed by itself in the previous version 3.0, and the plug-in architecture of Eclipse is very well-known in the whole industry, and it is also considered to be very successful A design, but Eclipse made a major decision in version 3.0 to overturn its own previous plug-in architecture and adopt OSGI as its plug-in architecture. The reason why Eclipse abandons its mature plug-in architecture and adopts OSGI is because of the standardization of OSGI and the more complete definition of plug-in architecture by OSGI. The success of Eclipse using OSGI as its plug-in architecture is Obviously, in Eclipse 3. After version 1, you can clearly feel the improvement of startup speed, and it also makes it possible to manage plug-ins at runtime. The more obvious improvement is that the development of plug-ins is more standardized, so that many existing OSGI plug-ins can be used. BMW's application control system uses OSGI as its underlying architecture. Many people think that java-based systems are inefficient and cannot be used in application control systems such as automobiles. This system is mainly used to control the speakers, lights and other equipment on the car. It consists of more than 1,000 bundles in total, but the startup time of the BMW car's application control system only takes 3.5 seconds. The efficiency of OSGI system is not low. Advantages of OSGI The first point, OSGI-based applications can dynamically change the running state and behavior. In the OSGI framework, each bundle is actually hot-pluggable, so modifications to a particular bundle will not affect all applications in the container, and most applications that run will work as usual. When you re-deploy the modified bundle, the container is never restarted. This dynamic state change is especially important in some very timely systems. Second, it is a stable and efficient system. OSGI is a microkernel system. The so-called microkernel means that its core has only a few jar packages. The system based on the OSGI framework can be divided and combined. The advantages of its structure make the specific Bundle not affect the overall situation, and will not lead to the collapse of the global system due to local errors. The third point is strong reusability. The OSGI framework itself is extremely reusable, and it is easy to build a truly interface-oriented program architecture. Each Bundle is an independent and reusable unit. Disadvantages of OSGI The management terminal is not powerful enough. The management terminal provided by the OSGI framework is not powerful enough. The current management terminal only provides basic bundle status management, log viewing and other functions, such as dynamic modification of system-level configuration (config.ini), dynamic modification Bundle configuration (Manifest. mf), startup level and other functions are not yet provided, and these are very necessary in the actual project or product. Using OSGI as the standard module development and deployment method naturally puts forward new requirements for existing developers. It is necessary to learn the new OSGI-based development method. What is Bundle? In the OSGI framework, the Bundle method is used to organize and deploy system Bundles In fact, it is a jar file. The only difference between this jar file and the ordinary jar file is the content of the MANIFEST.MF file in the Meta-inf directory. All the information about the Bundle is described in MANIFEST.MF, which can be called as The metadata of the bundle, which includes the name, description, developer, classpath of the bundle, the package to be imported, the package to be exported, etc. Bundle is an independent concept, and is used independently for each bundle in the OSGI framework. The classloader mechanism, which means that the traditional projects such as referencing other Bundles cannot be used to realize the cooperation between Bundles, so how does the Bundle cooperate in the OSGI framework? In the OSGI framework, each Bundle can be used. Define the output package and the referenced package, so that the classes in the package can be shared between Bundles, although this can also directly achieve simple Bundle collaboration, but in the OSGI framework, it is more recommended to use the Service method, Service- Everyone has been exposed to the concept of Oriented (such as SOA), and the same is true for the OSGI framework. Each Bundle can register the services provided externally through the BundleContext, and can also obtain the services that need to be referenced through the BundleContext. Service-Oriented The method can make the externally provided services more closed, and there is no need to set environmental dependencies in order to use the services provided by other Bundles. At the same time, Bundles can also use the Require-Bundle method to directly reference other Bundles (equivalent to projects or jars that reference other Bundles).

TechTarget China original content, original link:  http://www.searchsoa.com.cn/showcontent_57045.htm
© TechTarget China: http://www.techtarget.com.cn

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326853541&siteId=291194637