You are on page 1of 20

m m

m 
     
  
m  

OSGi Tooling Demo for


EclipseDemoCamp
mpache mries ± Project Overview

R 

Ted Kirby - IBM Software Developer

Demo Reference
http://bit.ly/eclipsedemocamp

Slide deck adapted from:


‡ https://svn.apache.org/repos/asf/incubator/aries/slides/mpa
che%20mries%20-%20Overview.ppt

2
mpache mries ± Project Overview

R

mries is a set of JEE components that have been fit into


the OSGi model according to the Blueprint container
specification.
‡ http://incubator.apache.org/aries/

The OSGi framework that mries runs in could be Equinox


or Felix.

3
mpache mries ± Project Overview

m    

Blueprint container
JPm integration
JTm integration
JMX
JNDI integration
mpplication assembly and deployment
METm-INF/services handler
Samples, documentation, integrator¶s guide

http://svn.apache.org/repos/asf/incubator/aries/trunk/

4
mpache mries ± Project Overview

m     


m DI container standardizing established Spring conventions

XML Blueprint definition describes component configuration and


scope
‡ Optionally publish and consume components to/from OSGi service
registry.

Managed beans

publishes consumes
service service

OSGI-INF/blueprint/
m static blueprint.xml
assembly and
configuration of
components Blueprint bundle
(POJOs)

5
mpache mries ± Project Overview

m     


Rm  
!"
   

m    rm
· Provide integrated development and test of
" * r OSGi mpplications on the WebSphere platform

Integrated with Web Tools, JEE productivity tools, and


Rm    other capabilities in RmD
 )  
 Supports deployment to WmS v7 OSGi FeP and includes
the FeP in the WmS Test Environment
     m(
 SCm support for OSGi mpplications
   + mdditional OSGi tools:
Graphical and wiring editor for Blueprint
Bundle Explorer
Tools for WmS OSGi extensions / Value-add
 "  &
(e.g. content assist, validation, re-factoring)
http://www-01.ibm.com/software/awdtools/developer
/application/index.html
     
m       
! " +  
m  
·Graphical tools to develop OSGi applications and
    ( ( bundles
R' )  
Includes features that increase developer productivity
Creates OSGi mpplications for any mries-based server
R"#$% " runtime.
  Eclipse WTP 3.6 (Helios) required


m   http://marketplace.eclipse.org/content/ibm-rational-
development-tools-osgi-applications
rm
6
mpache mries ± Project Overview

,

7
mpache mries ± Project Overview

m     


m DI container standardizing established Spring conventions
XML Blueprint definition describes component configuration and scope
‡ Optionally publish and consume components to/from OSGi service registry.
Simplifies unit test outside either Java EE or OSGi r/t.

The m"     is


Managed beans
highly extensible:
‡ Namespace handlers supported to extend
publishes consumes
service the Blueprint definitions
service
‡ Bean interceptors can be registered by
OSGI-INF/blueprint/ handlers
m static blueprint.xml
assembly and
configuration of
Other mries components contribute handlers ±
components
(POJOs)
Blueprint bundle ³jpa´ and ³jta´ handlers.
Some other mries components are
implemented as Blueprint bundles themselves
‡ e.g. JPm container

8
mpache mries ± Project Overview

m-"m  . m  / +"0


Persistence bundle Managed EntityManagerFactory
Provides support for ³mpplication Registered on behalf of the
 / 
managed´ JPm. 
persistence bundle

Each persistence bundle has its Meta-Persistence:


OSGI-INF/persistence.xml
standard JPm metadata located
through the Meta-Persistence OSGI-INF/
Entities
bundle header. persistence.xml Registers
EntityManagerFactory
JPm Container locates a JPm service per PU
Provider which can service the PU Uses

and registers a Provider-created org.apache.aries.jpa.container


EntityManagerFactory service for
each PU in each persistence Uses Used to build the
bundle EntityManagerFactory
‡ EMF service lifecyce follows
the persistence bundle createContainerEMF
(PersistenceUnitInfo)
lifecycle JPm Provider
JPm Provider gets persistence
javax.persistence.spi.
bundle classloader from PUInfo. PersistenceProvider
service

9
mpache mries ± Project Overview

m-"m  .     +


The mries JPm container context Example blueprint with JPm resource
bundle provides a blueprint injection and container-managed
namespace for dependency injection transactions:
of managed JPm resources.
Managed persistence units <*   
xmlns=† 
  
†
(EntityManagerFactory objects) can xmlns:jta=" 
    
"
be injected with or without a JTm xmlns:jpa=† 
   †>
Transaction Services <* id=Ë Ë Ë   >
implementation. < 1  property=† † unitname=†  
† />
<(* >
Managed persistence contexts
(EntityManager objects) are only <* id=†
  Ë Ë  !
 >
< 1 ) property=† † unitname=Ë  
Ë>
available with a JTm Transaction <1  method=³*" value=³Required" />
Services implementation. <(* >

Both managed persistence units and <(*   >


managed persistence contexts
behave as per the JPm specification.

10
mpache mries ± Project Overview

m-m +

mpache mries integrates the OSGi Transaction Service


Reference Implementation (mpache Geronimo
Transaction Manager).
mlso: transaction-
blueprint bundle
registers a ³jta´
Blueprint namespace
handler to provide
container-managed
transactions for BP
components

11
mpache mries ± Project Overview

m-/2 +

Implementation of OSGi JMX specification.


mries JMX bundle automatically registers the JMX
MBeans into any javax.management.MBeanServer
service in the OSGi Service Registry.
MBean MBean MBean
ramewor Bundle State Blueprint
MBean MBean MBean
ramewor MBeans
MBean Permissionmdmin
Permission
ompendium MBeans mdmin MBean
MBean Server
JMX OSGi MBean onfiguration mdmin
mdditional mries MBeans Manager onfiguration
mdmin MBean

MBean Provisioning Service


Provisi oning
ServiceMBean

MBean MBean MBean ser mdmin


Service St ate Pac age St ate ser mdmin
MBean MBean MBean

12
mpache mries ± Project Overview

m-3 +
Provides JNDI-based access to OSGi Service Registry

A 
 
A   
   
    
   
A 
A   
   
     
  

A 

registerService
m way for a Web component to access a
OSGi Blueprint component
Service Registry
getService
i   
 i   
 
  
 

JNDI Context   
  

13
mpache mries ± Project Overview

mm  m*&   &


The ³application´ project provides pluggable infrastructure to support
deployment of an application consisting of a collection of bundles as a
logical unit from an enterprise bundle archive (archive with .eba extn).
‡ mn ³Enterprise OSGi mpplication´.
Constituent bundles may be contained (³by-value´) in the .eba archive
or referenced in mPPLICmTION.MF
Only explicitly declared Services are exposed from the application.
Config by exception - absence of mPPLICmTION.MF means:
‡ application content is the set of bundles contained by-value plus any
repository-hosted dependencies identified during deployment.

 r  &


m  / 
Enumerates constituent bundles blog-persistence.jar
json4j.jar Declares mpplication ³externals´
blog.jar

blog.eba blog-servlet.jar

14
mpache mries ± Project Overview

mm  m*&   &


" ++*
m  r 
- NoOpResolver
mries mpplication = - OBRmriesResolver
creatempplication(eba)
org.apache.aries.application.management

" ++*  


- WabConverterService

M   


M    +"
M   
M     
 

  !"

 
 
!"

 
     
    +"#
#  
  $     '
 
  $   %&  '  (%'  
  $     '
 
  $   %  %'  
    $     '
 
    $   %  %'  
   $     '
 
   $   %&  '  )* 

,  ,$     

m  / (developer/assembler    artefact)   & / (+  during  

)
Enumerates constituent bundles and allowable version ranges Transitively closed description of all bundles resolved at
Declares mpplication ³externals´ specific versions to ³freeze-dry´ the application.

15
mpache mries ± Project Overview

m/m43!( " 

Common Java SE pattern for loading service provider interfaces:


config file in METm-INF/services containing class name of provider
implementation. For example JPm defines:
METm-INF/services/javax.persistence.spi.PersistenceProvider
‡ Problematic pattern for OSGi where a client import of
METm-INF/services gets resolved to one provider.
mries SPI-Fly project provides a generic solution

Service Provider bundle


org.apache.aries.spifly  / 
reads

SPI-Provider:
Registers service with property
spi.provider.url = URL to the associated
resource in OSGI-INF/services
OSGI-INF/services
³org.acme.impl.class´

16
mpache mries ± Project Overview

m  
mriesTrader ± mpache Geronimo DayTrader Java EE
benchmark application converted to OSGi mpplication
using web and blueprint components
‡ Objective is to demonstrate best practices
‡ Performance benchmarking
Blog Sample ± New application to demonstrate mries
features
The Samples illustrate how to run mries applications on a
standard OSGi f/w (e.g. Equinox) + mries +
dependencies (Derby DB, PaxWeb servlet container).
http://incubator.apache.org/aries/samples.html

17
mpache mries ± Project Overview

) 5 +6m  m 

* +$*
* +4 

Web application bundle

JNDI EM
WEB-INF/ Blogging OSGI-INF/
Blog
web.xml Service OSGI-INF/blueprint/ persistence.xml
blueprint.xml Persistence
Service
* +4 OSGI-INF/blueprint/
* + blueprint.xml

* +4  

18
mpache mries ± Project Overview

  m  

mries SNmPSHOT builds available right now


mries 0.1 Release content under discussion and will be
available soon.
mries components are currently used by:
‡ mpache Geronimo
‡ mpache Felix Karaf
‡ JBossOSGi
‡ WebSphere mpplication Server

19
mpache mries ± Project Overview

!  

There are many new application-centric features that


mries may develop including:
‡ message-driven blueprint components and services
‡ declarative role-based security for blueprint components
‡ annotation-based alternative to XML configuration
‡ resource-reference metadata and bindings
(Original Proposal: http://wiki.apache.org/incubator/mriesProposal)

Interested in getting involved?


‡ http://incubator.apache.org/aries/gettinginvolved.html

20