<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

     

    OSGi & Modularity

    from http://techdistrict.kirkk.com/2008/04/24/osgi-modularity/

        The .jar file has always been a great unit of modularity on the Java platform. Unfortunately, it also comes with the classpath baggage, and .jar files were never treated as first class components. OSGi is the next generation component platform that will bring greater modularity to the Java platform. In my previous blog, I showed the simplest OSGi components imaginable. Now I want to expand on that slightly by introducing a third component that exposes a key architectural and design benefit enabled by OSGi.

    A classic design statement in the GOF book states that we should separate interface from implementation. Java provides first class support for this heuristic through it’s use of interfaces, and we use it all the time. We know it’s good design. But another important design heuristic less often used states that interfaces should be placed separate from the classes that implement them. By placed, I mean the modules containing those interfaces. The result is subtle, yet has an important impact on design quality. The HelloWorld example serves as a good illustration.

    The HelloService interface is the specification implemented by the HelloServiceImpl. It decouples HelloClient from the implementation, and adheres to the GOF heuristic of separating interface from implementation. But bundling the interface in the same component as the implementation compromises design quality, and is the basis for the modularity heuristic above. Why? Because while I can still gain extensibility through new implementations of the interface, I lose flexibility in how I manage the implementations if the interface and implementation are deployed in the same component. For instance, in my previous example where the interface and implementation are deployed in service.jar, I don’t have the ability to dynamically replace the existing implementation with another because I can’t remove the implementation from the OSGi run-time if the interface and implementation are deployed together.

    But if I move the interface to a separate bundle, call it spec.jar, while leaving the implementation in service.jar, I do have the ability to swap implementations at run-time when using OSGi. In my Google Code repository exists the HelloWorldSpec project. There are four bundles - client.jar, spec.jar, service.jar, and service2.jar. Still a pretty simple example, but it illustrates the key design heuristic.

    In my initial deployment to Felix, I install client.jar, spec.jar, and service.jar. The results are the same as in my previous blog entry. But now, if I deploy and start service2.jar, stop service.jar, and stop client.jar, the OSGi run-time has managed to dynamically adapt to the changing conditions and discovers the service2.jar implementation of HelloWorldService. To experiment for yourself, do something like the folllowing after checking out the project from Google Code:

    • Build all four projects using ant build.all from the HelloWorldSpec root directory.
    • Start felix (you may have to modify the script - .bat or .sh - to find the felix.jar).
    • Use HelloWorldSpec as the profile if you want to use the bundles already installed, or create your own profile if you want to install them yourself.
    • If you used HelloWorldSpec as the profile, uninstall the service2.jar bundle. If you created your own profile, install spec.jar, service.jar and client.jar.
    • Stop client.jar and notice the message. Start client.jar back up.
    • Install and start service2.jar
    • Stop service.jar.
    • Stop client.jar again. Notice the message. Cool - an environment adaptable to changing conditions.

    As OSGi adoption continues, a new set of design principles are going to emerge surrounding modularity. I show but one example here of the benefit of placing interface in a module separate from implementation. An example of another important design principle enabled by OSGi is a PublishedInterface - public classes in a bundle’s exported packages. Something not supported by the JVM, but enabled by OSGi. In fact, I’ve long been an advocate of the .jar as a first class Java component, and some time ago launched Extensible Java to capture many of these modularity patterns. It’s also why I created JarAnalyzer. It’s time I revisit those ideas.

    posted on 2008-10-29 14:26 gembin 閱讀(585) 評論(0)  編輯  收藏 所屬分類: OSGi

    導航

    統計

    常用鏈接

    留言簿(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
    主站蜘蛛池模板: 人妻无码中文字幕免费视频蜜桃| 久久久亚洲精品蜜桃臀| 久久亚洲AV无码精品色午夜麻豆| 97在线免费视频| 亚洲乱码中文字幕久久孕妇黑人| 一区二区三区免费在线观看| 亚洲成?Ⅴ人在线观看无码| 日韩在线视精品在亚洲| 一级毛片直播亚洲| 一本大道一卡二大卡三卡免费| 亚洲狠狠爱综合影院婷婷| 和老外3p爽粗大免费视频| 亚洲日韩国产精品第一页一区| 99久久免费国产精品热| 亚洲国产精品国自产电影| 亚洲一区免费在线观看| 亚洲熟女精品中文字幕| 国产jizzjizz视频全部免费| 全黄A免费一级毛片| 久久久久亚洲AV无码专区首| 8x成人永久免费视频| 2020天堂在线亚洲精品专区| 青草草在线视频永久免费| 美女黄色毛片免费看| 亚洲成AV人片在| 日本亚洲免费无线码| 国产精品亚洲一区二区三区久久 | 99麻豆久久久国产精品免费| 亚洲国产综合专区在线电影| 一本无码人妻在中文字幕免费| 亚洲av无码一区二区三区四区 | 亚洲精品亚洲人成在线观看麻豆 | 亚洲一级毛片免费观看| 亚洲中文无码亚洲人成影院| 亚洲免费在线观看| 18pao国产成视频永久免费| 亚洲AV无码专区在线观看成人 | 又色又污又黄无遮挡的免费视| 中文字幕在线免费看线人| ASS亚洲熟妇毛茸茸PICS| 亚洲午夜AV无码专区在线播放|