Taming Beastly Web Applications with Server-Side OSGi

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    5 Favorites & 1 Event

    Taming Beastly Web Applications with Server-Side OSGi - Presentation Transcript

    1. Taming Beastly Web Applications with Server-Side OSGi Don Brown, Atlassian
    2. It starts so simple. . .
    3. Then this happens. . . SOAP interface REST interface IRC interface Slooow deployment Microsoft Excel export and import Report builder 50+ third-party libraries and frameworks PKI card authentication Thousands of classes
    4. Solution: Plugins Application Plugin Framework Excel REST IRC SOAP Plugin Plugin Plugin Plugin Report PKI Auth Plugin Plugin
    5. Anatomy of a Plugin Plugin JAR Java Utility JARs Classes Resources XML (images, Descriptor css, etc)
    6. ls myplugin.jar ./com/myplugin/HelloWorld.class ./resources/logo.png ./META-INF/lib/util.jar ./plugin.xml
    7. plugin.xml <plugin key=”my.plugin”> <plugin-info> <version>1.0</version> </plugin-info> <servlet key=”helloWorld” class=“com.myplugin.HelloWorld”> <url-pattern>/helloWorld</url-pattern> </servlet> </plugin>
    8. Not just any plugin framework . . . . . . Now Open Source (BSD)
    9. Right, but what does this have to do with OSGi?
    10. What if your plugins need plugins? Application Plugin Framework Excel REST IRC SOAP Plugin Plugin Plugin Plugin Report PKI Auth Plugin Plugin
    11. Want: inter-plugin communication Report Plugin Report Report Built-in Services UI Reports Users Sales Usage Reports Reports Reports Plugin Plugin Plugin
    12. Want: dynamic deployment plugins WEB-INF/lib
    13. Want: application and plugin isolation Application Internal External Internal Services Services Resources Excel REST IRC SOAP Plugin Plugin Plugin Plugin Report PKI Auth Plugin Plugin
    14. Want: application and plugin isolation Application Internal External Internal Services Services Resources Excel REST IRC SOAP Plugin Plugin Plugin Plugin Report PKI Auth Plugin Plugin
    15. OSGi Basics Dynamic module system for Java Features: • Service registry • Lifecycle model • Bundle dependency system • Optional security layer
    16. OSGi Terms Bundle - Jar file with special OSGi entries in its manifest and containing classes, resources, and other jars Lifecycle - States a bundle goes through: uninstalled, installed, resolved, starting, stopping, active Service - An object instance exposed under the one or more interfaces it implements and a map of properties
    17. Bundle Manifest Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.foo.Example Bundle-Version: 1.0 Import-Package: org.bar;version=\"1.3.0” Export-Package: org.foo.api Bundle-ClassPath: .,META-INF/lib/foo.jar
    18. Bundle Lifecycle
    19. OSGi Services Key: “com.foo.MyInterface” Instance: com.foo.MyService Properties: name => foo someProperty => someValue
    20. What does that mean? • Upgrade bundles (think super jars) at runtime • Bundles can depend on other bundles at a service, package, or jar level • Bundles can hide packages from other bundles and version exposed packages
    21. So how does OSGi help us?
    22. 1. Ability for plugins to depend on each other Plugins can generate their own OSGi headers or: <plugin-info> <bundle-instructions> <Require-Bundle> org.otherPlugin;bundle- version=\"[3.2.0,4.0.0)</Require-Bundle> <Import-Package> *,org.otherPlugin.api;version=”[3.2.0,4.0.0)” </ Import-Package> </bundle-instructions> </plugin-info>
    23. 2. Ability for plugins to define extension points 1. Plugin A exposes its implementation: <component key=“foo” public=“true” class=“org.bar.FooImpl” interface=“org.foo.Foo” /> 2. Plugin B imports the service: <component-import key=“foo” interface=“foo.Foo” />
    24. 3. Better insulate plugins from product changes • Host applications can decide which versioned packages to expose to plugins scanner.addPackageIncludes(Arrays.asList( “com.atlassian.*”, “org.apache.commons.*”)); • Host applications expose specific host components: <bean name=\"foo\" class=\"com.atlassian. FooableBean\" plugin:available=\"true\" /> Or @AvailableToPlugins public class MyManager implements Manager {...}
    25. Plugins 2
    26. Why should you care?
    27. Built for integration Shipped today with Atlassian applications with different: • Dependency injection libraries • Web frameworks • Persistence frameworks
    28. On to the code . . .
    29. Takeaway: Use plugins and OSGi to tame your beastly apps
    30. Questions? http://studio.atlassian.com/wiki/display/PLUG http://felix.apache.org

    + mrdonmrdon, 11 months ago

    custom

    1222 views, 5 favs, 0 embeds more stats

    Presentation given at OSDC Sydney 2008

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1222
      • 1222 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 5
    • Downloads 36
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events