Adapting Apache UIMA to OSGi     Tommaso Teofili | Adobe Basel R&D© 2012 Adobe Systems Incorporated. All Rights Reserved.
Agenda    The problem:         not-OSGi stuff in an OSGi world         use case    Possible adaption approaches discus...
Use case: Domeo    Annotation toolkit    create & share ontology based annotations    using AnnotationOntology RDF mode...
Apache UIMA    ASF top level project since 2010    Unstructured information management architecture    OASIS standard ...
Apache Clerezza    Apache Incubator project    Service platform for linked data    RDF API    JAX-RS implementation  ...
Clerezza - UIMA architecture overview                                                    JAX RS                           ...
The problem    Apache Clerezza         is OSGi based (running on Apache Felix)         artifacts delivered as bundles ...
Adapting to OSGi    Things to consider:         backward compatibility         development effort         classloading...
Adaption approaches    migrate everything to support (also?) OSGi    migrate something in a single lightweight bundle  ...
Approach #1 - migrate everything    pros         fully OSGi compatible         one time effort         fully leveragin...
Approach #2 - migrate something    pros         fully OSGi compatible         easier limited development effort       ...
Approach #3 - just wrap    pros         fully OSGi compatible         almost no development effort         everything ...
Approach #4 - adaption layer    pros         fully OSGi compatible         everything is available to OSGi client archi...
Managing requirements    Domeo concerns         OSGi compatibility         ease of development for UIMA users with (alm...
Feasible approaches    migrate everything > NO         need to touch the code base, not backward compatible    migrate ...
UIMA OSGi adaption layer known approaches    DME for UIMA from IBM AlphaWorks    Clerezza - UIMA integration module    ...
UIMA Dynamic Module Enabler© 2012 Adobe Systems Incorporated. All Rights Reserved.   17
Clerezza - UIMA adaption layer    simple API on top of UIMA API         create pipeline executor, give it a UIMA descrip...
Clerezza - UIMA : sample service    Consider an existing text mining application using UIMA for some     NLP task that ne...
Clerezza - UIMA : how it works    @Property(name = "javax.ws.rs", boolValue = true)    @Path("/uima")    public class O...
Clerezza - UIMA : sample service dependencies                                        OSGi container                       ...
Clerezza - UIMA : sample service classloading    Our sample service         has OpenNLP stuff in its classloader       ...
Clerezza - UIMA : runtime classloading dependencies                                        OSGi container                 ...
Clerezza - UIMA : managing classloading issue    we can leverage         OSGi activators             upon bundle activa...
Clerezza - UIMA : managing classloading issue      Sample service bundle                                              Serv...
Conclusions    Achievements         UIMA codebase not touched         fully OSGi compatible         lightweight    Le...
Thanks!    We’re hiring:         jobs-basel@adobe.com    Q&A© 2012 Adobe Systems Incorporated. All Rights Reserved.   27
© 2012 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Upcoming SlideShare
Loading in...5
×

Adapting Apache UIMA to OSGi

1,373

Published on

Adapting a not OSGi framework to OSGi based architectures is often a common need which needs to be managed together with other concerns like backward compatibility, multiple components packaging, evolution and flexibility.
Handling such needs can be tricky because of possible hurdles related to different class loading models, fine grained dependency management, semantic versioning, etc.
This talk deals with a real life use case of adapting a not OSGi ready framework like Apache UIMA (http://uima.apache.org) to a fully OSGi based architecture for the Apache Clerezza project (http://incubator.apache.org/clerezza) highlighting how the different class loading mechanisms (not OSGI vs OSGi) can be handled and adapted and how the two frameworks can be integrated leveraging the OSGi capabilities and still maintaing backward compatibility, flexibility, etc..

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,373
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
30
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Adapting Apache UIMA to OSGi

    1. 1. Adapting Apache UIMA to OSGi Tommaso Teofili | Adobe Basel R&D© 2012 Adobe Systems Incorporated. All Rights Reserved.
    2. 2. Agenda The problem:  not-OSGi stuff in an OSGi world  use case Possible adaption approaches discussion  an approach for our use case Conclusions© 2012 Adobe Systems Incorporated. All Rights Reserved. 2
    3. 3. Use case: Domeo Annotation toolkit create & share ontology based annotations using AnnotationOntology RDF model supporting (semi) automated annotation  Apache UIMA based text mining applications integrate via Apache Clerezza platform  but ... Clerezza is OSGi based while UIMA is not© 2012 Adobe Systems Incorporated. All Rights Reserved. 3
    4. 4. Apache UIMA ASF top level project since 2010 Unstructured information management architecture OASIS standard Powering  apps: IBM Watson, DeepQA, ...  platforms: Behemot, Domeo, U-Compare, ...© 2012 Adobe Systems Incorporated. All Rights Reserved. 4
    5. 5. Apache Clerezza Apache Incubator project Service platform for linked data RDF API JAX-RS implementation OSGi based Powering Apache Stanbol semantic content management project© 2012 Adobe Systems Incorporated. All Rights Reserved. 5
    6. 6. Clerezza - UIMA architecture overview JAX RS AE AE AE AE AE Clerezza platform UIMA Pipeline AO OSGi container Triple store© 2012 Adobe Systems Incorporated. All Rights Reserved. 6
    7. 7. The problem Apache Clerezza  is OSGi based (running on Apache Felix)  artifacts delivered as bundles Apache UIMA  is not OSGi based  is not OSGi ready  artifacts delivered as standard jars / PEARs  using reflection / custom classloading  has some OSGi artifacts for UIMA Eclipse plugins How to flawlessly let UIMA live and run inside Clerezza?© 2012 Adobe Systems Incorporated. All Rights Reserved. 7
    8. 8. Adapting to OSGi Things to consider:  backward compatibility  development effort  classloading  packaging / deployments  semantic versioning Business requirements are crucial to prioritize the above list© 2012 Adobe Systems Incorporated. All Rights Reserved. 8
    9. 9. Adaption approaches migrate everything to support (also?) OSGi migrate something in a single lightweight bundle migrate nothing and wrap everything in a single big bundle create an adaption layer ...© 2012 Adobe Systems Incorporated. All Rights Reserved. 9
    10. 10. Approach #1 - migrate everything pros  fully OSGi compatible  one time effort  fully leveraging OSGi capabilities cons  backward compatibility issues  significant development effort  consider integration effort  possibly keep / maintain different architectures at once  not always feasible  need full control© 2012 Adobe Systems Incorporated. All Rights Reserved. 10
    11. 11. Approach #2 - migrate something pros  fully OSGi compatible  easier limited development effort  facade package cons  need to keep maintaining OSGi and not-OSGi artifacts over time  not everything is available to OSGi client architectures  need full control on codebase© 2012 Adobe Systems Incorporated. All Rights Reserved. 11
    12. 12. Approach #3 - just wrap pros  fully OSGi compatible  almost no development effort  everything is available to OSGi client architectures cons  just not leveraging OSGi capabilities  possible classloading issues  need to keep managing OSGi and not OSGi artifacts over time© 2012 Adobe Systems Incorporated. All Rights Reserved. 12
    13. 13. Approach #4 - adaption layer pros  fully OSGi compatible  everything is available to OSGi client architectures  original not-OSGi stuff is not touched  no need to control not-OSGi stuff cons  some application specific development effort needed  explicitly managing classloading issues  need to keep managing this adaption layer© 2012 Adobe Systems Incorporated. All Rights Reserved. 13
    14. 14. Managing requirements Domeo concerns  OSGi compatibility  ease of development for UIMA users with (almost) no OSGi experience  leverage OSGi capabilities Communities concerns  Apache UIMA community was interested in OSGi but:  not willing to drop backward compatibility  not willing to migrate everything to OSGi right away  Apache Clerezza community was happy to have UIMA onboard but:  didn’t want to have release blocked by UIMA OSGi adaption© 2012 Adobe Systems Incorporated. All Rights Reserved. 14
    15. 15. Feasible approaches migrate everything > NO  need to touch the code base, not backward compatible migrate something > to a degree  existing UIMA users may need stuff not included in the lightweight pack just wrap > NO  classloading issues adaption layer > YES  but need to develop such a layer :-)© 2012 Adobe Systems Incorporated. All Rights Reserved. 15
    16. 16. UIMA OSGi adaption layer known approaches DME for UIMA from IBM AlphaWorks Clerezza - UIMA integration module UIMA integration for Apache Stanbol UIMA OSGi enablement via Maven ...© 2012 Adobe Systems Incorporated. All Rights Reserved. 16
    17. 17. UIMA Dynamic Module Enabler© 2012 Adobe Systems Incorporated. All Rights Reserved. 17
    18. 18. Clerezza - UIMA adaption layer simple API on top of UIMA API  create pipeline executor, give it a UIMA descriptor, run still can use plain UIMA API each bundle using UIMA just needs a specific OSGi activator lightweight© 2012 Adobe Systems Incorporated. All Rights Reserved. 18
    19. 19. Clerezza - UIMA : sample service Consider an existing text mining application using UIMA for some NLP task that needs to be plugged in Domeo it needs:  ReST endpoint  RDF API for dealing with ontologies  AnnotationOntology model awareness it already has:  one or more UIMA descriptors for its NLP pipeline(s)  UIMA components (either developed internally or publicly available) Let’s assume our sample service has one UIMA pipeline with one descriptor and uses Apache OpenNLP to extract person names from text© 2012 Adobe Systems Incorporated. All Rights Reserved. 19
    20. 20. Clerezza - UIMA : how it works @Property(name = "javax.ws.rs", boolValue = true) @Path("/uima") public class OpenNLPSampleService { .. @POST @Path("opennlp/person") @Produces("application/rdf+xml") public Graph extractPersons(@FormParam("uri") String uriString) { UIMAExecutor executor = ... ; Map<String, Object> parameters = ... ; parameters.put(“graph.name”, uriString); executor.analyzeDocument(text, new XMLInputSource(descriptor), parameters); } .. }© 2012 Adobe Systems Incorporated. All Rights Reserved. 20
    21. 21. Clerezza - UIMA : sample service dependencies OSGi container OpenNLP sample Clerezza service UIMA utils OpenNLP UIMA SDK depends on OSGi not OSGi© 2012 Adobe Systems Incorporated. All Rights Reserved. 21
    22. 22. Clerezza - UIMA : sample service classloading Our sample service  has OpenNLP stuff in its classloader  gets UIMA stuff from Clerezza UIMA utils bundle  nothing new but ...  UIMA uses XML descriptors in which component specific class names are given in order to instantiate pipelines  -> UIMA SDK uses the “famous” Class.forName(...)  -> everything should break in our case when instantiating pipelines since Clerezza UIMA utils bundle doesn’t hold OpenNLP stuff in its classloader© 2012 Adobe Systems Incorporated. All Rights Reserved. 22
    23. 23. Clerezza - UIMA : runtime classloading dependencies OSGi container OpenNLP sample Clerezza service UIMA utils OpenNLP UIMA SDK needs class from OSGi not OSGi© 2012 Adobe Systems Incorporated. All Rights Reserved. 23
    24. 24. Clerezza - UIMA : managing classloading issue we can leverage  OSGi activators  upon bundle activations notify “someone” that new UIMA components are available  UIMA resource managers  upon pipeline execution we can use a resource manager with a custom classloader  Solution:  each bundle using UIMA extends a specific OSGi activator (org.apache.clerezza.uima.utils.UIMABundleActivator) to explicitly declare its UIMA components  the Clereza UIMA utils module registers such components classloaders within an aggregate classloader which is passed to the UIMA resource manager at runtime© 2012 Adobe Systems Incorporated. All Rights Reserved. 24
    25. 25. Clerezza - UIMA : managing classloading issue Sample service bundle ServiceRegistry UIMABundleActivator Clerezza UIMA utils bundle UIMAComponentX UIMAResourcesClassLoaderRepository ResourceManager OpenNLP Sample Service AEProvider UIMAExecutorOSGi container© 2012 Adobe Systems Incorporated. All Rights Reserved. 25
    26. 26. Conclusions Achievements  UIMA codebase not touched  fully OSGi compatible  lightweight Left outs  semantic versioning  more OSGi capabilities could be leveraged (lots of UIMA API stuff could be exposed with OSGi services) Lessons learned  not only one good way  full OSGi migration is often not simple in the enterprise  using BNDTools / maven-bundle-plugin is sometimes not enough for migrating bundles because of application specific classloading issues© 2012 Adobe Systems Incorporated. All Rights Reserved. 26
    27. 27. Thanks! We’re hiring:  jobs-basel@adobe.com Q&A© 2012 Adobe Systems Incorporated. All Rights Reserved. 27
    28. 28. © 2012 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×