The new generation of lightweight http://www.aliyun.com/zixun/aggregation/15818.html "> Application Server--websphere Liberty profile server is not only used in its own construction OSGi development model, but also enables programmers to develop and deploy OSGi applications in Liberty.
This article provides readers with an example of how to use Websphere Liberty profile Server and Eclipse for software development of OSGi.
Some knowledge of preparation
Before reading this article, readers should have some understanding of WebSphere Liberty Profile server, and can refer to the author's another article, "A new generation of lightweight application server--websphere Liberty profiles" learning about The basics of Liberty. The OSGI framework adopted and supported by Liberty is the Eclipse Equinox, which implements an enterprise-class OSGi programming model that is Apache Aries. For this knowledge, readers can read the reference resources.
Before we start using Liberty and Eclipse to develop OSGi applications, we need to know a little bit about the architecture of Liberty. Because Liberty fully employs the OSGi architecture, understanding the OSGi architecture of Liberty will help us use it to develop OSGI applications, helping us to understand the underlying implementation of the software so that we can better utilize it to develop robust OSGI programs.
Liberty is a lightweight WebSphere application server based on the OSGi kernel, highly modular, and highly dynamic. The OSGi service provides lifecycle management of components that comprise Liberty, as well as dependency injection on configuration files. A complete Liberty service consists of the JVM, the Liberty kernel, and multiple optional Feature. All Feature and most Liberty cores are made up of OSGi Bundle that run within the same OSGi framework. Feature is primarily used to provide programming model support and Run-time services for applications.
Figure 1. Liberty Frame composition
Using Liberty and Eclipse to build an OSGi development environment
Installing Liberty and OSGi development tools
We assume that the reader has already downloaded and installed Oracle or IBM JDK in advance and configured the environment variables, which is necessary for Liberty to function properly. For development purposes, the use of Liberty, Liberty development tools, and OSGi development tools is completely free, and there is no time limit, and the installation process requires network connectivity.
Open Eclipse, click Help > Eclipse Marketplace, enter WebSphere in the page search box that appears, and click Search.
You'll see a tool in the search results that looks like a red box callout, where WebSphere Creator server V8.5 Liberty profile Developer Tools is a WebSphere Creator server A subset of V8.5 Developer tools can be installed directly to build a Liberty development environment, and if readers need to use Eclipse in conjunction with traditional was, then a later tool needs to be installed. In this article, we install the WebSphere creator Server V8.5 Liberty profile Developer Tools directly. After the installation process is complete, you need to restart Eclipse. After Eclipse restarts, select Servers View, right-click a new server, and appear as shown in the following figure, indicating that the Liberty development tool has been successfully installed
Figure 3. Verify that the Liberty development tool was installed successfully
Using the above method, use the keyword "OSGi" search to install the OSGi development tool from the Eclipse marketplace IBM Rational Development tools for OSGi applications, which is used to provide The ability to develop OSGi applications in Eclipse.