What OSGi is: The dynamic modular system of the Java language (i)

Source: Internet
Author: User

What is OSGi?

OSGi is also known as the dynamic modular system of the Java language , which defines an infrastructure for the development of modular applications. OSGi containers already have several open source implementations, such as Knoflerfish,Equinox , and Apache Felix. Through these containers, you can split your application into multiple module units so that you can more easily manage the cross-dependencies between these module units.

The OSGi specification is similar to the servlet specification and the EJB specification, which defines two objects, the one that the container provides to the service object , and the contract that must be adhered to between the container and your application , where the service object is the container to implement. If you want to develop on an OSGi platform, first, you must use the OSGi API to create your app and then deploy it to an OSGi container. From the developer's point of view, OSGi has the following advantages:

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 the module at the same time ;

c) OSGi provides an excellent infrastructure for the development of embedded applications, mobile applications, Rich Internet Applications (RIA)

If you're using a servlet container to develop your Web application and use an EJB container to develop a transactional application, you might ask, why do we need another container? The short answer to this question is that the Osig container is specifically prepared for the development of complex Java applications, where you need to divide these applications into modules in the development process. In the later articles of this series, I will start with this question and give a deep answer.

1. The application of OSGi in enterprise development

The OSGi Alliance (osgialliance) began developing the OSGi specification in March 1999 with the main goal of developing a set of open standards to provide manageable services to local area networks and their devices, and the basic idea is that Once you have used the OSGi service platform on network devices such as servers and embedded devices, you can manage the lifecycle of software components running on those devices anywhere on the network, installing, upgrading, or uninstalling them in the background without interrupting the device's normal operation.

In recent years, OSGi technology has been widely used in embedded system and network equipment market. Now, thanks to Eclipse's success, OSGi is becoming a viable and valuable technology in enterprise development.

1.1. Industry support for OSGi is increasing

In 2003, the Eclipse development team began to think of ways to improve the modularity of the Eclipse toolset to make it a more dynamic rich-client platform. The Eclipse team eventually selected the OSGi framework as the runtime model for its components, and the Eclipse3.0, released in June 2004, was the first OSGi platform-based version. Today, almost all enterprise application servers support osgi,spring and also support OSGi through a project called the spring Dynamic model on the OSGi Service platform (also known as osgispring). The project provides an OSGI infrastructure that makes it easier for us to use OSGi in spring's enterprise development.

2. Open-Source OSGi container

From an enterprise developer's point of view, OSGi container requirements are very low, you can easily embed it into enterprise applications, such as when we are developing Web applications, we can divide the Web application into multiple modules, one module is responsible for the view layer, the other module is responsible for the DAO layer, the third module is responsible for the data access layer, If we use OSGi containers to manage cross-dependencies between these modules, we can upgrade the DAO layer from slower to faster DAO without restarting the Web application.

As long as your application is compatible with the OSGi specification, your application should be able to run in any OSGi container, and now the more popular open source OSGi containers are available in the following three ways:

A) The Equinox container is implemented in reference to the OSGi specification version 4th, which forms the core of the Eclipse IDE-the modular Java runtime, which implements the functionality that must be enforced in the OSGi specification 4, while also implementing most of the optional features of the OSGI specification;

b) Knoflerfish is an open source implementation of the OSGi specification version 3rd and 4th, which implements the necessary functions and some optional functions required by the OSGI specification;

c) Apache Felix is an OSGi open-source container implemented by the Apache Software Foundation, which is not fully compatible with the OSGi specification until the deadline of this article. In this article, we will use Equinox as our OSGi container.

What OSGi is: The dynamic modular system of the Java language (i)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.