<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    gembin

    OSGi, Eclipse Equinox, ECF, Virgo, Gemini, Apache Felix, Karaf, Aires, Camel, Eclipse RCP

    HBase, Hadoop, ZooKeeper, Cassandra

    Flex4, AS3, Swiz framework, GraniteDS, BlazeDS etc.

    There is nothing that software can't fix. Unfortunately, there is also nothing that software can't completely fuck up. That gap is called talent.

    About Me

     

    Eclipse Equinox and OSGi

    Eclipse, Equinox, and OSGi

    Eclipse has been enormously popular as a tooling platform. With the use of Eclipse as a Rich Client Platform (RCP), Eclipse made a step towards being a runtime platform. Now, with the emergence of Eclipse on the server, Eclipse clearly has leapt into the runtime world. So what makes Eclipse capable of adapting to these different environments – what makes Eclipse tick?

    At its core, Eclipse has a modular Java runtime called Equinox ( http://eclipse.org/equinox). Equinox in turn is an implementation of the OSGi Alliance’s Service Platform R4 specification ( http://osgi.org). In fact, it is the reference implementation for the framework portion of that specification. At the heart of the OSGi specification is the notion of bundles.

    Bundles are used to capture modularity for Java. A bundle is just a standard Java JAR whose manifest contains extra markup identifying the bundle and laying out its dependencies. As such, each bundle is fully self-describing. Below is an example.

    Bundle-SymbolicName: org.eclipse.equinox.registry
    Bundle-Version: 3.2.100.v20060918
    Bundle-Name: Eclipse Extension Registry
    Bundle-Vendor: Eclipse.org

    Bundle-ClassPath: .

    Bundle-Activator: org.eclipse.core.internal.registry.osgi.Activator

    Export-Package: org.eclipse.equinox.registry

    Import-Package: javax.xml.parsers,
    org.xml.sax,
    org.osgi.framework;version=1.3
    Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.2.0,4.0.0)"
    Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,J2SE-1.3

    The first section identifies the bundle giving it a symbolic name, version and various human-readable descriptive values. The symbolic name and version go together to uniquely identify the bundle.

    The classpath entry details where, inside the bundle itself, the bundle’s code can be found. Specifying ‘.’ is the default and indicates that the bundle’s code is at the root of the bundle JAR itself.

    The OSGi architecture is highly dynamic. Bundles can come and go at any time in a session. The bundle activator allows bundles to hook the start() and stop() lifecycle events and thus perform initialization and cleanup as needed.

    Bundles that provide function to the rest of the system must expose the API for that function by exporting the API package. Exporting a package allows other bundles to reference the classes in the package. Notice that bundles can hide packages simply by not exporting them.

    Finally, bundles can express their dependence on code supplied by other bundles. This is done either indirectly using Import-Package statements or directly using the Require-Bundle header. Importing packages allows bundles to be bound (or wired as we say) to arbitrary providers of the needed packages. Conversely, directly requiring bundles allows for implementation-specific dependencies. In both cases the prerequisite can be qualified by version ranges and other markup to refine the dependency. Note also that bundles can specify dependencies on the underlying JRE used to run them. The bundle in this example can run on J2ME Foundation 1.0 or higher or J2SE 1.3 or higher.

    Given a set of bundles, Equinox resolves the dependencies and wires together the bundles. Bundles missing prerequisites are not resolved and are not eligible to be run. In the end each bundle has a dynamically computed and unique classpath that tells it exactly where to get its prerequisite code. Typically the standard Java application classpath is ignored and everything is computed from the expressed dependencies. Gone are the days of fighting with the global classpath.

    How do I program and run an Equinox based system?

    Developing bundles with Eclipse is the same as developing an Eclipse plug-in. In fact, there is no difference between bundles and plug-ins. While running the Eclipse SDK, simply use the New > Project > Plug-in Project wizard, enter a project name and select “OSGi framework” as the intended target platform (at the bottom of the wizard). Click Next until you get to the last page. Here you can choose from a set of templates. For your first bundle, choose the Hello OSGi Bundle template. Click Finish and you have a new bundle project.

    To run the bundle, right click on the bundle project and choose Run As… > Equinox. You should see a console appear with an “osgi>” prompt and the message “Hello World!!”. That message was printed by your new bundle. At the osgi> prompt you can type various commands. For example, you can stop your bundle by typing “stop <your bundle symbolic name>”. Note that by default the project name is used as the bundle’s symbolic name. You should see the “Goodbye World!!” message. You can of course restart the bundle using “start <bundle name>”. Go take a look at the code the wizard generated and you will see an Activator class with start() and stop() methods that print the corresponding messages. There are many more details and capabilities but this should get you running.

    What did I just do?

    An Equinox-based system consists of; Equinox itself, a set of bundles, and a configuration. The configuration is a list of bundles to run. This list is drawn from the pool of bundles available on the user’s machine. In the example above, the tooling created a configuration that included your bundle and all the bundles the system knew about and launched it. Note that in the simple workflow used here there are many extra bundles added to the configuration. For this example, you really only need your bundle and the org.eclipse.osgi bundle in the configuration.

    When Equinox is launched, it installs all of the bundles listed in the configuration, resolves them and starts any bundles listed as needed to be started. Since your bundle was installed and resolved and is listed (by default) as needing to be started, it was started and the Activator.start() method called and message printed.

    Equinox and OSGi in the larger context

    Both Equinox and OSGi are seeing a surge in interest from a wide range of communities from embedded, the traditional domain of OSGi, to desktop tools and applications to mobile devices and servers. The server side work is of particular interest.

    The Equinox project has a server side effort that seeks to integrate the dynamic module capabilities of OSGi into standard application server scenarios (see http://eclipse.org/equinox/server). There are two main approaches; embedding Equinox in the servlet container or embedding the servlet container in Equinox. To a large extent the choice made here does not impact your server application or functionality. The choice is more a function of the infrastructure needs of your environment. For example, are there other standard web applications running, are you using clustering or other infrastructure, …

    The following three diagrams illustrate the traditional
    web application server setup and contrasts it with the Equinox in Container approach and the Container in Equinox approach. Equinox is embedded in an existing servlet container as shown in Figure 2 by installing a very thin web application. This application contains a Bridge Servlet that launches an Equinox instance inside the application and then forwards all requests to the Equinox-based application (servlets, JSPs, …) via a very lightweight HTTP service.

    In Figure 3, the approach is turned around and Equinox runs an application container (e.g., embedded Jetty) and provides some glue code that wires Equinox-based applications into the application container.

    Figure 1: Traditional web application server structure

     

    Figure 2: Embedding Equinox in an existing application container

     

    Figure 3: Embedding an application container in Equinox

    In both Equinox-based scenarios, writing your application is the same. You create a bundle project using the Eclipse plug-in development environment (PDE) and add the static content, servlets and JSPs as needed. Then add traditional Eclipse extension markup to surface your content in the user’s URL space. The snippet below shows an example.

    <plugin>
    <extension point="org.eclipse.equinox.http.registry.resources">
    <resource
    alias="/files"
    base-name="/web_files"/>
    </extension>
    <extension point="org.eclipse.equinox.http.registry.servlets">
    <servlet
    alias="/test"
    class="com.example.servlet.MyServlet"/>
    </extension>
    </plugin>

    The first extension places the content of the “web_files” directory of the bundle at /files in the user’s URL space (e.g., http://localhost/files/...). The second extension places MyServlet at /test in the URL space (e.g., http://localhost/test).

    The easiest way of running you application is to launch directly from Eclipse using the Container in Equinox approach. This is the same process you used with the example bundle above and allows you to run without setting up an application server or deploying the code. As a result it is much faster and easier to test and debug. For complete instructions, see the Server-side QuickStart Guide at http://eclipse.org/equinox/documents/http_quickstart.php.

    Since your function is defined in bundles and running in Equinox, everything is dynamic and extensible. You can add, remove and update dynamically without taking down the server, the URL space is updated as you modify the function available and your business logic can be reused on the server, the desktop and in mobile clients.

    What’s next for Equinox and OSGi?

    Equinox is a mature codebase with millions of users – after all, every Eclipse user is running Equinox. Nonetheless the Equinox team is continually refining the implementation and adding support for new use cases.

    OSGi on the server and in the enterprise is becoming increasingly interesting. The next version of IBM’s flagship WebSphere Application Server is actually based on Equinox under the covers. The OSGi Alliance is responding to the increased interest by creating an Enterprise Expert Group (EEP) to look at issues such as distributed computing, multi-language support and enterprise wide provisioning.

    The general Java community has recognized that it too can benefit from the modularity that OSGi brings. While JSR 277 seeks to add a level of modularity in the Java 7 timeframe, JSRs 232 and 291 provide OSGi-based dynamic Java modularity to Java today. These two JSRs enable OSGi-based modularity at all levels of Java from J2ME CDC/Foundation 1.0 to J2SE 1.3 and up.

    The explosion in interest in Equinox and OSGi should not have surprised us but it did. Many people in the Java community are struggling with system complexity and management issues. With Eclipse, Equinox and OSGi you too can enjoy the benefits of modular, componentized Java wherever you compute.

    Biographies

    Jeff McAffer leads the Eclipse RCP and Runtime teams and is one of the Eclipse Platform's original architects and committers. Prior to his work at IBM's Ottawa Software Lab, he was a developer at Object Technology International focusing on areas such as distributed/parallel OO computing, expert systems, and meta-level architectures. Jeff holds a Ph.D. from the University of Tokyo.

    Simon Kaegi works at Cognos as a developer looking at the run-time provisioning of enterprise software. A committer on the Eclipse Equinox project his current focus is on enabling the many use-cases for OSGi in server-side environments.

    posted on 2008-04-30 16:09 gembin 閱讀(1313) 評論(0)  編輯  收藏 所屬分類: Eclipse

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿(6)

    隨筆分類(440)

    隨筆檔案(378)

    文章檔案(6)

    新聞檔案(1)

    相冊

    收藏夾(9)

    Adobe

    Android

    AS3

    Blog-Links

    Build

    Design Pattern

    Eclipse

    Favorite Links

    Flickr

    Game Dev

    HBase

    Identity Management

    IT resources

    JEE

    Language

    OpenID

    OSGi

    SOA

    Version Control

    最新隨筆

    搜索

    積分與排名

    最新評論

    閱讀排行榜

    評論排行榜

    free counters
    主站蜘蛛池模板: 久久免费国产视频| 丰满少妇作爱视频免费观看| 久操免费在线观看| 国产亚洲精品成人AA片新蒲金 | 成年性午夜免费视频网站不卡| 亚洲a在线视频视频| 免费不卡在线观看AV| 亚洲成人动漫在线| 中文字幕免费高清视频| 亚洲第一成年人网站| 国产免费毛不卡片| 亚洲性无码AV中文字幕| 国产又长又粗又爽免费视频 | 精品久久久久久国产免费了| 国产成人综合亚洲AV第一页| a毛片视频免费观看影院| 午夜亚洲www湿好大| 91精品免费在线观看| 亚洲欧洲日韩极速播放| 日本v片免费一区二区三区| 特级毛片全部免费播放a一级| 浮力影院亚洲国产第一页| 野花香在线视频免费观看大全 | 五月婷婷免费视频| 久久综合图区亚洲综合图区| 91精品啪在线观看国产线免费| 亚洲伊人色一综合网| 国产成人啪精品视频免费网| 一级特黄色毛片免费看| 色婷婷亚洲十月十月色天| 女人18毛片水真多免费看| 四虎影视久久久免费| 久久99亚洲网美利坚合众国 | 在线观看免费a∨网站| 一级特黄录像免费播放中文版| 亚洲AV成人片色在线观看| 免费看少妇作爱视频| 精品一区二区三区免费视频| 亚洲大香人伊一本线| 亚洲高清免费视频| 8x8x华人永久免费视频|