SlideShare une entreprise Scribd logo
1  sur  121
Télécharger pour lire hors ligne
Ekkehard Gentz, Independent Software Architect



 HowTo Build an OSGI EJB3 Server
 OSGI Experts Day 2009-05-24



                                                        1
 (c) 2009 ekkehard gentz, eclipse public license EPL
Who am I

 ekke
   Ekkehard Gentz, Rosenheim
   Freelancer, Software Architect, ERP Consultant
   Business Developer (ERP Solutions)
     Assembler, Cobol, Pascal,4GL, Java

     Domains: Apple Dealer, Paper Manufacturer, Waste &
      Recycling, ...




                               3
Why this session

 So many articles and guidelines about OSGI:
   how to do it the right way
 Is this reality for OSGI Enterprise Apps ?
 you have to...
   ... live with existing code
   ... use 3rd party bundles
   ... integrate different OSGI products, frameworks etc




                                  4
Business Project Overview

 Project built from scratch
 Business Processes and Rules change 'daily'
 Short time-frame
 Small Project Ressources
 Possible to make it run ?




                           6
7
Business Project Requirements

 Easy to use for business users
 Server 24*7 online
 Rich Clients with great UI comfort
 Processes and Rules change heavy and often
 Has to run on different OS (XP, Vista, OSX)




                          8
Project Decisions

 Frameworks
 Tools
 Technology




                    9
Design and Modeling Tools

 UML (MagicDraw)
   MD DSL Customization Engine
   MD Customized Domain-Specific Editors
   MD Reader available
   Eclipse - Integration
 Why not EMF - only ?
 Combine UML and EMF
   oAW as Generatorframework

                            10
Eclipse RCP (SWT) as Rich Client

 Eclipse RCP Platform
 plus Riena UI
   Ridgets
   Markers
   Validators
 plus Riena Navigation
 plus redView dynamic Views for Business Apps
 CDO distributed view models

                          11
OSGI (Equinox) as Server

 OSGI
  modular, dynamic updates
  flexible server architecture
 Why Equinox as OSGI Framework ?
  its Eclipse ;-)
  Riena uses Buddy Policy
    so I‘m bound to Equinox




                               12
Services and Persistence: EJB3, JPA

 Easybeans choosen
   pure OSGI bundle implementation
     vs WSAD, Glassfish or other OSGI-based JEE Server:
       integrate Easybeans into your OSGI Enterprise app

       all is under your control, no deploy to Appserver

 Hibernate as JPA provider
   my knowledge of Hibernate
   already bundled with EasyBeans OSGI


                                       13
Drools Business Rules and Process Flow

 First decision: jBPM + Drools
   jBPM as BusinessProcess Engine
   Drools as Rules Engine + Decision Nodes in jBPM
 Drools 5 supports both:
   Business Process Flow
   Business Rules




                            14
RDBMS: IBM DB2 Express

 Relational data and xml data can be mixed
 low costs for small companies
 scales well if company grows
 I know it




                        15
BIRT as Reporting Engine

 Perfect Integration into Eclipse world
 Reports direct from DB2 RDBMS
 Reports directly using Hibernate Pojos




                          16
Why OSGI and EJB3

 EJB3 Standard
 Out of the box directly from EJB3 Container
   services
   persistence
   transactions
 OSGI goes Enterprise
 Easybeans OSGI JPA Container



                         17
Why not CDO to persist Business Models

 Pros:
   all stored in EMF Models, EMF Databinding
   no lazy exceptions from hibernate at client side
   scales very well, persistence (Teneo, Hibernate)
 Cons:
   model evolution not supported, no data-migration
   no reporting tools like BIRT to use CDO repositories
   future: could be an alternate way

                            18
OSGI Server

 Bundles
  entity
  ejb, interfaces
  enumerations
 Fragments
  icons, fonts, OS-dependent-styles
  Logging Utils, Logging Configuration



                           19
OSGI Server (Bundles)
  Bundles
                                                                          @Local,
                                          Business - Interface Bundles

    entity
                                                                          @Remote



                                   @Stateless,
                    EJB Bundles
    ejb
                                   @Stateful
                                      @EJB
                                                 implements
                                                                              implements



    interfaces
                                                                                           @Stateless
                                                                                      @PersistenceContext
                                                         injects


                                   uses            @Entity,

    enumerations                                @Embeddable
                                                                   uses


                                                                          PersistenceContext Bundles


                         Entity Bundles
                                                                               Enum




                                  Enumeration Bundles




                          20
Entity Bundles
  Bundles
                                                         @Entity,
    unlimited                                         @Embeddable



    per Subapplication

    per Subdomain                    Entity Bundles



    Productfamilies

  Tip:
    used at Client and Server

    Server-only Dependencies should be optional




                                 21
Enumeration Bundles
  Bundles
    per Subapplication
                                                      Enum




    per Subdomain              Enumeration Bundles


    per Customer / Product

  Why separate Bundles ?
    Enumeration Literals different per Customers

    Easy to change / enhance

    Also used by Business Processes, Rules




                                22
PersistenceContext Bundles
                                                      @Stateless
  Bundles                                         @PersistenceContext




    Stateless Beans
    implements BusinessInterfaces      PersistenceContext Bundles


    contains PersistenceContext (EntityManager)

    only used at Server

  Tip:
    JIRA EZB-294 all EJB‘s of PersistenceContext = 1 Bundle

    All @Entity and @Embeddable must be listed inside
     persistence.xml because of a Bug


                              23
Persistence     MyBean.java (in a PersistenceContext Bundle)


Context
Configuration
                    META-INF/persistence.xml


                                                         Datei




                   config/easybeans.xml




                                                     Datei




                            24
EJB Bundles
                                                  @Stateless,
  Bundles                          EJB Bundles   @Stateful
                                                     @EJB



    Stateless or Stateful
    only used at Server

    can inject other EJB‘s from PersistenceContext Bundles

    Productfamilies

  Tip:
    @EJB(mappedName) BusinessInterface
    JIRA EZB-322 can‘t found Interfaces from other Bundles




                               25
Business Interface Bundles
  Bundles                                                           @Local,
                                      Business - Interface Bundles
                                                                     @Remote

    Local or Remote
    unlimited Bundles

    structured per Subdomain, Product, ...

    used on Client and Server




                                 26
OSGI Server (Fragments)
  Fragments
    Icons
    Fonttemplates

    OS-dependent-styles

    Logging - Utilities




                           27
MDSD

 openArchitectureWare (oAW)
  perfect integrated into eclipse
  working with UML and EMF models side-by-side
  generating:
    Entity, EJB, Business Interfaces

    BusinessProcess /-rules Integration

    EMF View models from Entity

    configuration files and more



                                29
oAW
                  mo                  )…
                e                 raw es …
              D
        ime                    icD lat
    ckt                     ag
Qui                      (M       mp Views)
                      ram re) Te
                   iag Wa            mic
                 D
           tity cture            yna
       En                    -D
              hite
   ML                    MF
 U        Arc iena - E
     pen
  (o           (R
         iew
     edV
   r
Eclipse Workspaces and Installations

 Overview
 Different Eclipse Installations for different Roles
   Architect and Modeler
   Client-Server-Platform Developer
   UI Designer (Development)
   UI Design and Prototyping (Business User)




                            32
Eclipse Workspaces and Installations

                           Eclipse Installations       Eclipse Workspaces


                                                                   java
                                                                   entity
                            Eclipse Modeling        my oAW         ejb
                                                   Cartridges      services
                                                                   processes




               Modeling
                          EMF
                          UML2
                          openArchitectureWare           uses
                          - XPand
                          - XTend
                          - Workflow
                                                                   abc
                                                    Project        foo
                                                   Workflows        sample




                                                                generates




                                                           Project code
                                                          Project quot;fooquot;
                            Eclipse Runtime
               Runtime




                          Target Platform
                                                                    entity
                                                                    ejb - beans
                          Equinox
                                                                    ejb - api
                                                     Project
                          RCP
                                                                    services
                                                     Bundles
                          Riena
                                                                    processes
                          EasyBeans
                                                                    rules
                                                                    ui




                                            33
34
Problems to solve

 Integrate 3rd Party
 Bundle Start Order
 Services, ServiceTracker or DS ?
 Logging Frameworks and OSGI
 Dependency Cycles
 Classloader used by 3rdParty
 How to configure Target Platform
 Problems solved using oAW

                         35
36
HowTo integrate 3rdParty Bundles (1)

 Are they all brave OSGI citizens ?
   1 jar == 1 bundle
   import package instead of required bundles ?
   always Versioning Bundles and Dependencies ?




                           37
dle
               mo                    Bun -)
            De
         ime                     ter        “;
      kt                      ns
  uic                                  rs ?
                           Mo
                        GI
Q                                   ja
                      S
                   n O unt the
                ea
            sid         co
          n        you
      ki
  loo         can
         …„
      or
   …
HowTo integrate 3rdParty Bundles (2)

 Are there any Monsters ?
   look inside EasyBeans core bundle


 Are there dependency - cycles ?
   SLF4J + Logback, Easybeans




                          41
42
Bundle Start Order (1)

 Goal: Try to avoid Start-Levels needed
   but 3rdParty:
     Agents like EasyBeans Agent

   Logging first if using Log Bridges from OSGI
     start first to avoid black holes




                                   43
Bundle Start Order (2)

 To make a System run:
   try using Start-Levels
   then Iterations:
     Add OSGI Services
     Add ServiceTracker to start Bundles
     Add DeclarativeServices to reduce ServiceTracker Complexity




                                44
Bundle Start
Order (3)




               45
Bundle Start
Order (3)
                           ns
                        io
                   at
                 er
               it
            ly
         ar
       e




                                45
Bundle Start Order (4)




 ServerAgent
   tracks Services from EasyBeans using a
    ServiceTracker
   registers @Remote Interfaces for Riena
   registers a Service if all is done



                              46
Bundle Start Order (4)

                             ns
                          io
                     at
                   er
                 it
              ly
           ar
         e
 ServerAgent
   tracks Services from EasyBeans using a
    ServiceTracker
   registers @Remote Interfaces for Riena
   registers a Service if all is done



                                  46
Bundle Start Order (5)




 MyServer
 waits for the ServerAgent - Service
 registers a Service if all is ready
 registers this also as RienaRemote Service
   now the Clients know that the Domain Server runs


                               47
Bundle Start Order (5)

                         ns
                      io
                 at
               er
             it
         rly
       ea
 MyServer
 waits for the ServerAgent - Service
 registers a Service if all is ready
 registers this also as RienaRemote Service
   now the Clients know that the Domain Server runs


                               47
Bundle Start
Order (6)
 Using Declarative
  Services
 TODO:
   replace
    Easybeans Agent
    by own
    Implementation
    using DS




                      48
Bundle Start
Order (6)
 Using Declarative
  Services
 TODO:
   replace
    Easybeans Agent
    by own
    Implementation
    using DS




                      48
Services, Services, Services...

 Riena Remote Services
 EasyBeans Services
 ServiceTracker
 Declarative Services (DS)
 ServiceTracker vs DS




                          49
Riena Remote Services (1)




                     50
Riena Remote Services (2)

 Publishing Service




                       51
Riena Remote Services (3)

 Injecting Service
   the Riena Way (fluent interfaces)




 I prefer DeclarativeServices




                            52
EasyBeans Services (1)

 EasyBeans registers Services for each Business
  Interface (@Local, @Remote)
   thanks to the EZB Team:
   changed to ManagedServices, so Properties can easy
    used
     in Filters of ServiceTrackers

     or DeclarativeServices (DS)




                                  53
EasyBeans Services (2)

 EasyBeans registers:
   ManagedServiceFactory Services for each EasyBeans
    components:Transactions, Mail, JDBCPool, JMS, etc
   EZBContainer Services
    EJB3Container ready
    PersistenceContext: Hibernate Mapping, Binding
   JDBCPoolComponent
     the DataSource is available



                                54
Service Tracker (1)

 start EJB Bundles ?               ManagedServiceFactory registered




                                                              all EZB
                               JDBCPool
                                                            Components
                              Component ?
                                                            registered ?


                                   Yes


                             register JNDI for
                               DataSource




                             all DataSources
                                registered ?          Yes


                                          Yes


                                            Start EJB Bundles




                        55
Service Tracker (1)

 start EJB Bundles ?               ManagedServiceFactory registered




                                                              all EZB
                               JDBCPool
                                                            Components



                                                                                      ns
                              Component ?
                                                            registered ?



                                                                                   io
                                                                              at
                                   Yes


                                                                            er
                                                                          it
                             register JNDI for



                                                                       ly
                               DataSource



                                                                    ar
                                                                  e
                             all DataSources
                                registered ?          Yes


                                          Yes


                                            Start EJB Bundles




                        55
Service Tracker (2)

 EasyBeans                        ManagedServiceFactory registered




  Components ?
     carol, hsqldb,
                                                            all EZB
                                                          Components
                                                          registered ?


      jotm, quartz,
      event, jmx,
      jdbcpool, joram
     Services named
      like
    carol-component-factory





                              56
Service Tracker (2)

 EasyBeans                        ManagedServiceFactory registered




  Components ?
     carol, hsqldb,
                                                            all EZB
                                                          Components



                                                                                    ns
                                                          registered ?



                                                                                 io
      jotm, quartz,
                                                                            at
                                                                          er
      event, jmx,
                                                                        it
                                                                     ly
      jdbcpool, joram
                                                                  ar
                                                                e
     Services named
      like
    carol-component-factory





                              56
Service Tracker (3)

 DataSources                     ManagedServiceFactory registered




  registered ?
   easybeans.xml            JDBCPool
                            Component ?


                                 Yes


                           register JNDI for
                             DataSource




                           all DataSources
                              registered ?




                      57
Service Tracker (3)

 DataSources                     ManagedServiceFactory registered




  registered ?
   easybeans.xml            JDBCPool



                                                                                   ns
                            Component ?




                                                                                io
                                                                           at
                                 Yes


                                                                         er
                                                                       it
                           register JNDI for



                                                                    ly
                             DataSource



                                                                 ar
                                                               e
                           all DataSources
                              registered ?




                      57
Service Tracker (4)




                      58
Service Tracker (5)

 start EJB Bundles:               ManagedServiceFactory registered




 EasyBeans creates                                          all EZB

  EJB3-Container              JDBCPool
                                                           Components
                             Component ?
                                                           registered ?



  for each                        Yes



  PersistenceContext        register JNDI for
                              DataSource


  Bundle
                            all DataSources
                               registered ?          Yes


                                         Yes


                                           Start EJB Bundles




                       59
Service Tracker (5)

 start EJB Bundles:               ManagedServiceFactory registered




 EasyBeans creates                                          all EZB

  EJB3-Container              JDBCPool
                                                           Components



                                                                                     ns
                             Component ?
                                                           registered ?



                                                                                  io
  for each
                                                                             at
                                  Yes


                                                                           er
  PersistenceContext                                                     it
                            register JNDI for



                                                                      ly
                              DataSource



                                                                   ar
  Bundle
                                                                 e
                            all DataSources
                               registered ?          Yes


                                         Yes


                                           Start EJB Bundles




                       59
Service Tracker (6)

 EasyBeans registers:
                                                             ManagedServices
                                                             registered by EasyBeans
                             ManagedService registered
                                                             for Business - Interfaces
                                                             implemented by
                                                             @Stateless or @Statefull Beans
                                                             from EJB - Bundles


 ManagedService for
                                 Remote Business
                                   - Interface ?




  @Local, @Remote                      Yes



                         register as Riena Remote Endpoint



 EZBContainer
                                                             EZB Container Service registered




  Service for each         EZBContainerServices                      Container for all
                                                                     EJB Bundles ?
                           registered by EasyBeans


  EJB3-Container
                           for each EJB - Bundle

                                                                          Yes


                                                                       register
                                                             RienaEasyBeansServerService




                         60
Service Tracker (7)

 ServiceTracker now tracks ManagedServices
 tests for some Properties from EasyBeans
 registers Services as RienaRemoteService




                        61
ns
                                                    io
                                               at
Service Tracker (7)                          er
                                           it
                                        ly
                                     ar
                                   e
 ServiceTracker now tracks ManagedServices
 tests for some Properties from EasyBeans
 registers Services as RienaRemoteService




                         61
Service Tracker (8)

 All logic around EasyBeans EJB3-Container at a
  central point
 Sounds good ?


 Difficult to maintain or to test


 What to do ?



                            62
Declarative Services (1)

 We can describe the same complex logic solved
  with ServiceTracker using
 DeclarativeServices (DS)
   let the OSGI Framework do the work
   easy to maintain
   lazy loading of Bundles
 Eclipse 3.4 Ganymede: edit XML files
 Eclipse 3.5 Galileo: PDE Tooling-Support


                              63
ion
                                                lut
Declarative Services (1)                     so
                                        al
                                     fin
 We can describe the same complex logic solved
  with ServiceTracker using
 DeclarativeServices (DS)
   let the OSGI Framework do the work
   easy to maintain
   lazy loading of Bundles
 Eclipse 3.4 Ganymede: edit XML files
 Eclipse 3.5 Galileo: PDE Tooling-Support


                              63
Declarative Services (2)

 Example „EasyBeans Components started ?“




                      64
ion
                                           lut
Declarative Services (2)                so
                                   al
                                fin
 Example „EasyBeans Components started ?“




                      64
Declarative Services (3)

 Example „EasyBeans Components started ?“




                      65
ion
                                           lut
Declarative Services (3)                so
                                   al
                                fin
 Example „EasyBeans Components started ?“




                      65
Declarative Services (3)

 OSGI Runtime with DeclarativeServices
   Wondering why a DS not started ?


   Tip:
   set debug-trace-log vm-parameters:
   -Dequinox.ds.debug=true




                          66
Declarative Services (4)

 Console Output:




                      67
Declarative Services (5)

 some more Properties:
   equinox.ds.print=true prints tracelogs to console

   equinox.ds.perf=true logs execution times in ms

   equinox.scr.waitTimeOnBlock=10000 how many ms
   should DS ait until a service component is ready




                           68
Service Tracker vs Declarative Services

 Are DS replacement for ServiceTracker (ST) ?
   ST has access to all methods of a Service
   DS only access to properties
 Missing graph visualization for some Dependencies




                           69
Service Tracker vs Declarative Services

 Over all my recommendation:


 Use Declarative Services where possible


 Equinox DS will do all the difficult work for you




                           70
Logging with OSGI and 3rdParty

 OSGI Logging
 'classic' Logging
 Compare LoggingFrameworks
 HowTo integrate them all




                        71
OSGI Logging

 LogService
 Equinox Extended LogService
  graduated soon




                       72
Classic Logging

 Log4J
 CommonsLogging
 SLF4J
 JDK Logging (java.util)




                            73
Logging used by ...

 ...Easybeans
   Commons-Logging
   JDK Logging
 Riena
   Extended LogService
   Start Parameters, ExtensionPoint
 Hibernate
   switched from CommonsLogging to SLF4J

                           74
Compare LogFrameworks




                  75
HowTo integrate them all

 SLF4JoverOSGI Bridge
   SLF4J with logback implementation
     catches JCL, JDK, SLF4J, OSGI Log, ext. Log

   Marker and Bundles
   Fragments
 alternate Solution: PAX Logging
   Log4J
     catches JCL, JDK, SLF4J, Avalon


                               76
HowTo integrate them all




                    77
HowTo solve Dependency Cycles

 Eclipse 3.4
   PDE Export has Problems with Cycles
   Equinox Runtime works well




   Trick:
     put a „Fake“ Bundle without Dependencies into Workspace




                               78
HowTo solve Dependency Cycles

 Eclipse 3.5M6 PDE Tooling Support




   dont forget to set Compiler Warnings:




                            79
Classloader from 3rd party

 EasyBeans contains Hibernate
   Hibernate uses ContextClassLoader


 Try to avoid
   Dynamic Import *
   BuddyPolicy only if really needed




                            80
HowTo configure the TargetPlatform (1)

 Overview
 TargetPlatformDefinition Files
   to be portable: variable - string substitution
   PDE Tooling 3.5 easier
 Duplicates, Deltas
   Bugzilla Reports discuss better PDE Tooling support




                              82
HowTo configure the TargetPlatform (2)

 Locations




                    83
HowTo configure the TargetPlatform (3)




                    84
HowTo configure the TargetPlatform (3)




                    84
oAW - your little Helper

 EZB, Hibernate Bug Annotations
   generate classnames into persistence.xml
 Check JPA Persistence data
   length of indizes, tables, inheritance strategies
 EZB problems JNDI naming
   generate mapped Names into Interfaces
 Bridge between UML and EMF
   from UML to EMF - UI and back

                             85
oAW - solves Bug detecting Entity

 generate classnames into persistence.xml




                        86
oAW - solves Bug injecting @EJB (1)

 generate @EJB.mappedName




                     87
oAW - solves Bug injecting @EJB (2)

 generate @EJB.mappedName




                     88
oAW - solves Bug injecting @EJB (3)

 generate @EJB.mappedName


 now its easy to use:
 @EJB (mappedName = MyInterface.EZB_MAPPED_NAME)
 MyInterface mi = null;




                          89
Summary
 Server
    Equinox (OSGI Framework), Riena (OSGI RemoteServices)

    EasyBeans (OSGI EJB3 Container, JPA, Hibernate)

 Rich Client
    Eclipse RCP, Riena (UI Ridgets and Navigation)

    Riena (OSGI Remote Services, ObjectTransactions)

 ModelDriven Project
    Eclipse Modeling (EMF, UML, CDO)

    openArchitectureWare (oAW): Workflow, XPand, Xtend

    MagicDraw (UML, DSL, oAW Integration)


                                         90
mo                   na,           db
             De                   rie ata to
          me                 ox, e d
      kti
  uic                     uin som               ith
Q                       q
                    r: e rite              es w
                 rve … w               fil
                                   log
              se
          the EJB3             ck)
                            ba
     art ans            log
  st                4J/
           e
      syb h (SLF
   ea tc
       wa
    …
           h…
     lilit
Next Steps

 Other ways to persist ?
 More M2M Transformations
 Give Value back to Open Source Community




                            94
Alternate Ways to Persist Data

 EasyBeans and EclipseLink
   EasyBerans provides both: Hibernate + EclipseLink
 CDO with Teneo Hibernate
   re-use of JPA Annotations for Teneo
   EMF Databinding
   CDO remoting instead of RienaRemoteOSGI
   possible ????



                           95
Extra M2M transformation

 whole Business Model as EMF
  extra M2M transformation from UML
  pro:
    redView Drag‘n‘Drop for Databinding
    needed if CDO in the future becomes an alternative




                               96
97
open-erp-ware.org (1)

 Open Source OSGI - EJB3 - Riena Server
  core equinox-EasyBeans OSGI-EJB3 server
  UML Profiles (Java, JPA, EJB3, Drools)
  oAW Templates and Cartridges
  MagicDraw DSL Customization + Editors
  Riena for Remote OSGI Services
  plus core ERP functionality (business modules)
  first beta published in june 2009


                            98
open-erp-ware.org (2)

 slf4joverOSGI
   LoggingBridge
     could be used additional to SLF4J / LogBack Bridges




                               99
redView - Riena EMF Dynamic Views
 Open Source Dynamic Views for Business Applications
   EMF
   CDO

   Ridgets

   Prototyping
   WYSIWYG Editor for dynamic SWT Views




                             100
Question & Answer

 ekke@ekkes-corner.org
 Blog: http://ekkes-corner.org (en)
 Blog: http://ekkes-ecke.org (de)
 Video Podcasts: http://ekkes-corner-tv.org
 Twitter: @ekkescorner


 http://open-erp-ware.org
 http://redview.org


                          101
Video Podcast

 you like to watch and hear this screencast as a
  Video Podcast ?


 visit: http://ekkes-corner-tv.org
 or search iTunes for „ekkes-corner“




 (c) 2009 ekkehard gentz, eclipse public license EPL


                                 102

Contenu connexe

Tendances

Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Java EE 6 Component Model Explained
Java EE 6 Component Model Explained
Shreedhar Ganapathy
 
Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)
Hamed Hatami
 
Java EE6 CodeCamp16 oct 2010
Java EE6 CodeCamp16 oct 2010Java EE6 CodeCamp16 oct 2010
Java EE6 CodeCamp16 oct 2010
Codecamp Romania
 

Tendances (20)

Sun Java EE 6 Overview
Sun Java EE 6 OverviewSun Java EE 6 Overview
Sun Java EE 6 Overview
 
Java EE 6 Component Model Explained
Java EE 6 Component Model Explained Java EE 6 Component Model Explained
Java EE 6 Component Model Explained
 
The Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the CloudThe Java EE 7 Platform: Developing for the Cloud
The Java EE 7 Platform: Developing for the Cloud
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
FraSCAti with OSGi
FraSCAti with OSGiFraSCAti with OSGi
FraSCAti with OSGi
 
Jsf+ejb 50
Jsf+ejb 50Jsf+ejb 50
Jsf+ejb 50
 
Web Application Architecture
Web Application ArchitectureWeb Application Architecture
Web Application Architecture
 
Running your Java EE applications in the Cloud
Running your Java EE applications in the CloudRunning your Java EE applications in the Cloud
Running your Java EE applications in the Cloud
 
If You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and PortletsIf You Know JSF, You Know Portals and Portlets
If You Know JSF, You Know Portals and Portlets
 
Java 7 workshop
Java 7 workshopJava 7 workshop
Java 7 workshop
 
Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)Java EE 7 (Hamed Hatami)
Java EE 7 (Hamed Hatami)
 
JEE Course - JEE Overview
JEE Course - JEE  OverviewJEE Course - JEE  Overview
JEE Course - JEE Overview
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
Osgi platform
Osgi platformOsgi platform
Osgi platform
 
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
Java EE 7: Developing for the Cloud at Java Day, Istanbul, May 2012
 
Do We Need Esb Any More
Do We Need Esb Any MoreDo We Need Esb Any More
Do We Need Esb Any More
 
Java EE6 CodeCamp16 oct 2010
Java EE6 CodeCamp16 oct 2010Java EE6 CodeCamp16 oct 2010
Java EE6 CodeCamp16 oct 2010
 
Designing JEE Application Structure
Designing JEE Application StructureDesigning JEE Application Structure
Designing JEE Application Structure
 
Java EE 7 - Overview and Status
Java EE 7  - Overview and StatusJava EE 7  - Overview and Status
Java EE 7 - Overview and Status
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
 

En vedette (6)

Lls Def 2010
Lls Def 2010Lls Def 2010
Lls Def 2010
 
Angel Fernández Miami Ad School Planner 2009
Angel Fernández Miami Ad School Planner 2009Angel Fernández Miami Ad School Planner 2009
Angel Fernández Miami Ad School Planner 2009
 
Getting Through a Volatile Market
Getting Through a Volatile MarketGetting Through a Volatile Market
Getting Through a Volatile Market
 
Caravana Etti 2009
Caravana Etti 2009Caravana Etti 2009
Caravana Etti 2009
 
Presentingtheunpresentable
PresentingtheunpresentablePresentingtheunpresentable
Presentingtheunpresentable
 
CM Williams Visual Resume 2009
CM Williams Visual Resume 2009CM Williams Visual Resume 2009
CM Williams Visual Resume 2009
 

Similaire à HowTo Build an OSGI EJB3 Server

Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
Alassane Diallo
 
JEE Course - EJB
JEE Course - EJBJEE Course - EJB
JEE Course - EJB
odedns
 
Adopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy ContextAdopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy Context
Xavier Warzee
 
Egl Rui Ajax World
Egl Rui Ajax WorldEgl Rui Ajax World
Egl Rui Ajax World
rajivmordani
 

Similaire à HowTo Build an OSGI EJB3 Server (20)

Real world java_ee_patterns
Real world java_ee_patternsReal world java_ee_patterns
Real world java_ee_patterns
 
JEE Course - EJB
JEE Course - EJBJEE Course - EJB
JEE Course - EJB
 
Adopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy ContextAdopting Agile Tools & Methods In A Legacy Context
Adopting Agile Tools & Methods In A Legacy Context
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client Development
 
Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture Trends
 
Practical WebAssembly with Apex, wasmRS, and nanobus
Practical WebAssembly with Apex, wasmRS, and nanobusPractical WebAssembly with Apex, wasmRS, and nanobus
Practical WebAssembly with Apex, wasmRS, and nanobus
 
New Features of Java7 SE
New Features of Java7 SENew Features of Java7 SE
New Features of Java7 SE
 
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
Three Key Concepts for Understanding JSR-352: Batch Programming for the Java ...
 
Java Ide Day 2008 - Presentation on JDeveloper by Paolo Ramasso
Java Ide Day 2008 - Presentation on JDeveloper by Paolo RamassoJava Ide Day 2008 - Presentation on JDeveloper by Paolo Ramasso
Java Ide Day 2008 - Presentation on JDeveloper by Paolo Ramasso
 
EJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another IntroductionEJB 3.0 - Yet Another Introduction
EJB 3.0 - Yet Another Introduction
 
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJava EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
 
Egl Rui Ajax World
Egl Rui Ajax WorldEgl Rui Ajax World
Egl Rui Ajax World
 
Introduction To Web Beans
Introduction To Web BeansIntroduction To Web Beans
Introduction To Web Beans
 
Template Building Workshop
Template Building WorkshopTemplate Building Workshop
Template Building Workshop
 
Ejb
EjbEjb
Ejb
 
Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...Next-Generation Enterprise Application Development with SpringSource dm Serve...
Next-Generation Enterprise Application Development with SpringSource dm Serve...
 
Deep Dive into AWS Fargate
Deep Dive into AWS FargateDeep Dive into AWS Fargate
Deep Dive into AWS Fargate
 
Alessandro Salvatico - Sviluppare J2EE con INGRES
Alessandro Salvatico - Sviluppare J2EE con INGRESAlessandro Salvatico - Sviluppare J2EE con INGRES
Alessandro Salvatico - Sviluppare J2EE con INGRES
 
Deep dive into AWS fargate
Deep dive into AWS fargateDeep dive into AWS fargate
Deep dive into AWS fargate
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

HowTo Build an OSGI EJB3 Server

  • 1. Ekkehard Gentz, Independent Software Architect HowTo Build an OSGI EJB3 Server OSGI Experts Day 2009-05-24 1  (c) 2009 ekkehard gentz, eclipse public license EPL
  • 2.
  • 3. Who am I  ekke  Ekkehard Gentz, Rosenheim  Freelancer, Software Architect, ERP Consultant  Business Developer (ERP Solutions)  Assembler, Cobol, Pascal,4GL, Java  Domains: Apple Dealer, Paper Manufacturer, Waste & Recycling, ... 3
  • 4. Why this session  So many articles and guidelines about OSGI:  how to do it the right way  Is this reality for OSGI Enterprise Apps ? you have to...  ... live with existing code  ... use 3rd party bundles  ... integrate different OSGI products, frameworks etc 4
  • 5.
  • 6. Business Project Overview  Project built from scratch  Business Processes and Rules change 'daily'  Short time-frame  Small Project Ressources  Possible to make it run ? 6
  • 7. 7
  • 8. Business Project Requirements  Easy to use for business users  Server 24*7 online  Rich Clients with great UI comfort  Processes and Rules change heavy and often  Has to run on different OS (XP, Vista, OSX) 8
  • 9. Project Decisions  Frameworks  Tools  Technology 9
  • 10. Design and Modeling Tools  UML (MagicDraw)  MD DSL Customization Engine  MD Customized Domain-Specific Editors  MD Reader available  Eclipse - Integration  Why not EMF - only ?  Combine UML and EMF  oAW as Generatorframework 10
  • 11. Eclipse RCP (SWT) as Rich Client  Eclipse RCP Platform  plus Riena UI  Ridgets  Markers  Validators  plus Riena Navigation  plus redView dynamic Views for Business Apps  CDO distributed view models 11
  • 12. OSGI (Equinox) as Server  OSGI  modular, dynamic updates  flexible server architecture  Why Equinox as OSGI Framework ?  its Eclipse ;-)  Riena uses Buddy Policy  so I‘m bound to Equinox 12
  • 13. Services and Persistence: EJB3, JPA  Easybeans choosen  pure OSGI bundle implementation  vs WSAD, Glassfish or other OSGI-based JEE Server:  integrate Easybeans into your OSGI Enterprise app  all is under your control, no deploy to Appserver  Hibernate as JPA provider  my knowledge of Hibernate  already bundled with EasyBeans OSGI 13
  • 14. Drools Business Rules and Process Flow  First decision: jBPM + Drools  jBPM as BusinessProcess Engine  Drools as Rules Engine + Decision Nodes in jBPM  Drools 5 supports both:  Business Process Flow  Business Rules 14
  • 15. RDBMS: IBM DB2 Express  Relational data and xml data can be mixed  low costs for small companies  scales well if company grows  I know it 15
  • 16. BIRT as Reporting Engine  Perfect Integration into Eclipse world  Reports direct from DB2 RDBMS  Reports directly using Hibernate Pojos 16
  • 17. Why OSGI and EJB3  EJB3 Standard  Out of the box directly from EJB3 Container  services  persistence  transactions  OSGI goes Enterprise  Easybeans OSGI JPA Container 17
  • 18. Why not CDO to persist Business Models  Pros:  all stored in EMF Models, EMF Databinding  no lazy exceptions from hibernate at client side  scales very well, persistence (Teneo, Hibernate)  Cons:  model evolution not supported, no data-migration  no reporting tools like BIRT to use CDO repositories  future: could be an alternate way 18
  • 19. OSGI Server  Bundles  entity  ejb, interfaces  enumerations  Fragments  icons, fonts, OS-dependent-styles  Logging Utils, Logging Configuration 19
  • 20. OSGI Server (Bundles)  Bundles @Local, Business - Interface Bundles  entity @Remote @Stateless, EJB Bundles  ejb @Stateful @EJB implements implements  interfaces @Stateless @PersistenceContext injects uses @Entity,  enumerations @Embeddable uses PersistenceContext Bundles Entity Bundles Enum Enumeration Bundles 20
  • 21. Entity Bundles  Bundles @Entity,  unlimited @Embeddable  per Subapplication  per Subdomain Entity Bundles  Productfamilies  Tip:  used at Client and Server  Server-only Dependencies should be optional 21
  • 22. Enumeration Bundles  Bundles  per Subapplication Enum  per Subdomain Enumeration Bundles  per Customer / Product  Why separate Bundles ?  Enumeration Literals different per Customers  Easy to change / enhance  Also used by Business Processes, Rules 22
  • 23. PersistenceContext Bundles @Stateless  Bundles @PersistenceContext  Stateless Beans  implements BusinessInterfaces PersistenceContext Bundles  contains PersistenceContext (EntityManager)  only used at Server  Tip:  JIRA EZB-294 all EJB‘s of PersistenceContext = 1 Bundle  All @Entity and @Embeddable must be listed inside persistence.xml because of a Bug 23
  • 24. Persistence MyBean.java (in a PersistenceContext Bundle) Context Configuration META-INF/persistence.xml Datei config/easybeans.xml Datei 24
  • 25. EJB Bundles @Stateless,  Bundles EJB Bundles @Stateful @EJB  Stateless or Stateful  only used at Server  can inject other EJB‘s from PersistenceContext Bundles  Productfamilies  Tip:  @EJB(mappedName) BusinessInterface  JIRA EZB-322 can‘t found Interfaces from other Bundles 25
  • 26. Business Interface Bundles  Bundles @Local, Business - Interface Bundles @Remote  Local or Remote  unlimited Bundles  structured per Subdomain, Product, ...  used on Client and Server 26
  • 27. OSGI Server (Fragments)  Fragments  Icons  Fonttemplates  OS-dependent-styles  Logging - Utilities 27
  • 28.
  • 29. MDSD  openArchitectureWare (oAW)  perfect integrated into eclipse  working with UML and EMF models side-by-side  generating:  Entity, EJB, Business Interfaces  BusinessProcess /-rules Integration  EMF View models from Entity  configuration files and more 29
  • 30. oAW mo )… e raw es … D ime icD lat ckt ag Qui (M mp Views) ram re) Te iag Wa mic D tity cture yna En -D hite ML MF U Arc iena - E pen (o (R iew edV r
  • 31.
  • 32.
  • 33.
  • 34. Eclipse Workspaces and Installations  Overview  Different Eclipse Installations for different Roles  Architect and Modeler  Client-Server-Platform Developer  UI Designer (Development)  UI Design and Prototyping (Business User) 32
  • 35. Eclipse Workspaces and Installations Eclipse Installations Eclipse Workspaces java entity Eclipse Modeling my oAW ejb Cartridges services processes Modeling EMF UML2 openArchitectureWare uses - XPand - XTend - Workflow abc Project foo Workflows sample generates Project code Project quot;fooquot; Eclipse Runtime Runtime Target Platform entity ejb - beans Equinox ejb - api Project RCP services Bundles Riena processes EasyBeans rules ui 33
  • 36. 34
  • 37. Problems to solve  Integrate 3rd Party  Bundle Start Order  Services, ServiceTracker or DS ?  Logging Frameworks and OSGI  Dependency Cycles  Classloader used by 3rdParty  How to configure Target Platform  Problems solved using oAW 35
  • 38. 36
  • 39. HowTo integrate 3rdParty Bundles (1)  Are they all brave OSGI citizens ?  1 jar == 1 bundle  import package instead of required bundles ?  always Versioning Bundles and Dependencies ? 37
  • 40.
  • 41. dle mo Bun -) De ime ter “; kt ns uic rs ? Mo GI Q ja S n O unt the ea sid co n you ki loo can …„ or …
  • 42.
  • 43.
  • 44.
  • 45. HowTo integrate 3rdParty Bundles (2)  Are there any Monsters ?  look inside EasyBeans core bundle  Are there dependency - cycles ?  SLF4J + Logback, Easybeans 41
  • 46. 42
  • 47. Bundle Start Order (1)  Goal: Try to avoid Start-Levels needed  but 3rdParty:  Agents like EasyBeans Agent  Logging first if using Log Bridges from OSGI  start first to avoid black holes 43
  • 48. Bundle Start Order (2)  To make a System run:  try using Start-Levels  then Iterations:  Add OSGI Services  Add ServiceTracker to start Bundles  Add DeclarativeServices to reduce ServiceTracker Complexity 44
  • 50. Bundle Start Order (3) ns io at er it ly ar e 45
  • 51. Bundle Start Order (4)  ServerAgent  tracks Services from EasyBeans using a ServiceTracker  registers @Remote Interfaces for Riena  registers a Service if all is done 46
  • 52. Bundle Start Order (4) ns io at er it ly ar e  ServerAgent  tracks Services from EasyBeans using a ServiceTracker  registers @Remote Interfaces for Riena  registers a Service if all is done 46
  • 53. Bundle Start Order (5)  MyServer  waits for the ServerAgent - Service  registers a Service if all is ready  registers this also as RienaRemote Service  now the Clients know that the Domain Server runs 47
  • 54. Bundle Start Order (5) ns io at er it rly ea  MyServer  waits for the ServerAgent - Service  registers a Service if all is ready  registers this also as RienaRemote Service  now the Clients know that the Domain Server runs 47
  • 55. Bundle Start Order (6)  Using Declarative Services  TODO:  replace Easybeans Agent by own Implementation using DS 48
  • 56. Bundle Start Order (6)  Using Declarative Services  TODO:  replace Easybeans Agent by own Implementation using DS 48
  • 57. Services, Services, Services...  Riena Remote Services  EasyBeans Services  ServiceTracker  Declarative Services (DS)  ServiceTracker vs DS 49
  • 59. Riena Remote Services (2)  Publishing Service 51
  • 60. Riena Remote Services (3)  Injecting Service  the Riena Way (fluent interfaces)  I prefer DeclarativeServices 52
  • 61. EasyBeans Services (1)  EasyBeans registers Services for each Business Interface (@Local, @Remote)  thanks to the EZB Team:  changed to ManagedServices, so Properties can easy used  in Filters of ServiceTrackers  or DeclarativeServices (DS) 53
  • 62. EasyBeans Services (2)  EasyBeans registers:  ManagedServiceFactory Services for each EasyBeans components:Transactions, Mail, JDBCPool, JMS, etc  EZBContainer Services EJB3Container ready PersistenceContext: Hibernate Mapping, Binding  JDBCPoolComponent  the DataSource is available 54
  • 63. Service Tracker (1)  start EJB Bundles ? ManagedServiceFactory registered all EZB JDBCPool Components Component ? registered ? Yes register JNDI for DataSource all DataSources registered ? Yes Yes Start EJB Bundles 55
  • 64. Service Tracker (1)  start EJB Bundles ? ManagedServiceFactory registered all EZB JDBCPool Components ns Component ? registered ? io at Yes er it register JNDI for ly DataSource ar e all DataSources registered ? Yes Yes Start EJB Bundles 55
  • 65. Service Tracker (2)  EasyBeans ManagedServiceFactory registered Components ?  carol, hsqldb, all EZB Components registered ? jotm, quartz, event, jmx, jdbcpool, joram  Services named like carol-component-factory  56
  • 66. Service Tracker (2)  EasyBeans ManagedServiceFactory registered Components ?  carol, hsqldb, all EZB Components ns registered ? io jotm, quartz, at er event, jmx, it ly jdbcpool, joram ar e  Services named like carol-component-factory  56
  • 67. Service Tracker (3)  DataSources ManagedServiceFactory registered registered ?  easybeans.xml JDBCPool Component ? Yes register JNDI for DataSource all DataSources registered ? 57
  • 68. Service Tracker (3)  DataSources ManagedServiceFactory registered registered ?  easybeans.xml JDBCPool ns Component ? io at Yes er it register JNDI for ly DataSource ar e all DataSources registered ? 57
  • 70. Service Tracker (5)  start EJB Bundles: ManagedServiceFactory registered  EasyBeans creates all EZB EJB3-Container JDBCPool Components Component ? registered ? for each Yes PersistenceContext register JNDI for DataSource Bundle all DataSources registered ? Yes Yes Start EJB Bundles 59
  • 71. Service Tracker (5)  start EJB Bundles: ManagedServiceFactory registered  EasyBeans creates all EZB EJB3-Container JDBCPool Components ns Component ? registered ? io for each at Yes er PersistenceContext it register JNDI for ly DataSource ar Bundle e all DataSources registered ? Yes Yes Start EJB Bundles 59
  • 72. Service Tracker (6)  EasyBeans registers: ManagedServices registered by EasyBeans ManagedService registered for Business - Interfaces implemented by @Stateless or @Statefull Beans from EJB - Bundles  ManagedService for Remote Business - Interface ? @Local, @Remote Yes register as Riena Remote Endpoint  EZBContainer EZB Container Service registered Service for each EZBContainerServices Container for all EJB Bundles ? registered by EasyBeans EJB3-Container for each EJB - Bundle Yes register RienaEasyBeansServerService 60
  • 73. Service Tracker (7)  ServiceTracker now tracks ManagedServices  tests for some Properties from EasyBeans  registers Services as RienaRemoteService 61
  • 74. ns io at Service Tracker (7) er it ly ar e  ServiceTracker now tracks ManagedServices  tests for some Properties from EasyBeans  registers Services as RienaRemoteService 61
  • 75. Service Tracker (8)  All logic around EasyBeans EJB3-Container at a central point  Sounds good ?  Difficult to maintain or to test  What to do ? 62
  • 76. Declarative Services (1)  We can describe the same complex logic solved with ServiceTracker using  DeclarativeServices (DS)  let the OSGI Framework do the work  easy to maintain  lazy loading of Bundles  Eclipse 3.4 Ganymede: edit XML files  Eclipse 3.5 Galileo: PDE Tooling-Support 63
  • 77. ion lut Declarative Services (1) so al fin  We can describe the same complex logic solved with ServiceTracker using  DeclarativeServices (DS)  let the OSGI Framework do the work  easy to maintain  lazy loading of Bundles  Eclipse 3.4 Ganymede: edit XML files  Eclipse 3.5 Galileo: PDE Tooling-Support 63
  • 78. Declarative Services (2)  Example „EasyBeans Components started ?“ 64
  • 79. ion lut Declarative Services (2) so al fin  Example „EasyBeans Components started ?“ 64
  • 80. Declarative Services (3)  Example „EasyBeans Components started ?“ 65
  • 81. ion lut Declarative Services (3) so al fin  Example „EasyBeans Components started ?“ 65
  • 82. Declarative Services (3)  OSGI Runtime with DeclarativeServices  Wondering why a DS not started ?  Tip:  set debug-trace-log vm-parameters: -Dequinox.ds.debug=true 66
  • 83. Declarative Services (4)  Console Output: 67
  • 84. Declarative Services (5)  some more Properties:  equinox.ds.print=true prints tracelogs to console  equinox.ds.perf=true logs execution times in ms  equinox.scr.waitTimeOnBlock=10000 how many ms should DS ait until a service component is ready 68
  • 85. Service Tracker vs Declarative Services  Are DS replacement for ServiceTracker (ST) ?  ST has access to all methods of a Service  DS only access to properties  Missing graph visualization for some Dependencies 69
  • 86. Service Tracker vs Declarative Services  Over all my recommendation:  Use Declarative Services where possible  Equinox DS will do all the difficult work for you 70
  • 87. Logging with OSGI and 3rdParty  OSGI Logging  'classic' Logging  Compare LoggingFrameworks  HowTo integrate them all 71
  • 88. OSGI Logging  LogService  Equinox Extended LogService  graduated soon 72
  • 89. Classic Logging  Log4J  CommonsLogging  SLF4J  JDK Logging (java.util) 73
  • 90. Logging used by ...  ...Easybeans  Commons-Logging  JDK Logging  Riena  Extended LogService  Start Parameters, ExtensionPoint  Hibernate  switched from CommonsLogging to SLF4J 74
  • 92. HowTo integrate them all  SLF4JoverOSGI Bridge  SLF4J with logback implementation  catches JCL, JDK, SLF4J, OSGI Log, ext. Log  Marker and Bundles  Fragments  alternate Solution: PAX Logging  Log4J  catches JCL, JDK, SLF4J, Avalon 76
  • 94. HowTo solve Dependency Cycles  Eclipse 3.4  PDE Export has Problems with Cycles  Equinox Runtime works well  Trick:  put a „Fake“ Bundle without Dependencies into Workspace 78
  • 95. HowTo solve Dependency Cycles  Eclipse 3.5M6 PDE Tooling Support  dont forget to set Compiler Warnings: 79
  • 96. Classloader from 3rd party  EasyBeans contains Hibernate  Hibernate uses ContextClassLoader  Try to avoid  Dynamic Import *  BuddyPolicy only if really needed 80
  • 97.
  • 98. HowTo configure the TargetPlatform (1)  Overview  TargetPlatformDefinition Files  to be portable: variable - string substitution  PDE Tooling 3.5 easier  Duplicates, Deltas  Bugzilla Reports discuss better PDE Tooling support 82
  • 99. HowTo configure the TargetPlatform (2)  Locations 83
  • 100. HowTo configure the TargetPlatform (3) 84
  • 101. HowTo configure the TargetPlatform (3) 84
  • 102. oAW - your little Helper  EZB, Hibernate Bug Annotations  generate classnames into persistence.xml  Check JPA Persistence data  length of indizes, tables, inheritance strategies  EZB problems JNDI naming  generate mapped Names into Interfaces  Bridge between UML and EMF  from UML to EMF - UI and back 85
  • 103. oAW - solves Bug detecting Entity  generate classnames into persistence.xml 86
  • 104. oAW - solves Bug injecting @EJB (1)  generate @EJB.mappedName 87
  • 105. oAW - solves Bug injecting @EJB (2)  generate @EJB.mappedName 88
  • 106. oAW - solves Bug injecting @EJB (3)  generate @EJB.mappedName  now its easy to use: @EJB (mappedName = MyInterface.EZB_MAPPED_NAME) MyInterface mi = null; 89
  • 107. Summary  Server  Equinox (OSGI Framework), Riena (OSGI RemoteServices)  EasyBeans (OSGI EJB3 Container, JPA, Hibernate)  Rich Client  Eclipse RCP, Riena (UI Ridgets and Navigation)  Riena (OSGI Remote Services, ObjectTransactions)  ModelDriven Project  Eclipse Modeling (EMF, UML, CDO)  openArchitectureWare (oAW): Workflow, XPand, Xtend  MagicDraw (UML, DSL, oAW Integration) 90
  • 108. mo na, db De rie ata to me ox, e d kti uic uin som ith Q q r: e rite es w rve … w fil log se the EJB3 ck) ba art ans log st 4J/ e syb h (SLF ea tc wa … h… lilit
  • 109.
  • 110.
  • 111.
  • 112.
  • 113. Next Steps  Other ways to persist ?  More M2M Transformations  Give Value back to Open Source Community 94
  • 114. Alternate Ways to Persist Data  EasyBeans and EclipseLink  EasyBerans provides both: Hibernate + EclipseLink  CDO with Teneo Hibernate  re-use of JPA Annotations for Teneo  EMF Databinding  CDO remoting instead of RienaRemoteOSGI  possible ???? 95
  • 115. Extra M2M transformation  whole Business Model as EMF  extra M2M transformation from UML  pro:  redView Drag‘n‘Drop for Databinding  needed if CDO in the future becomes an alternative 96
  • 116. 97
  • 117. open-erp-ware.org (1)  Open Source OSGI - EJB3 - Riena Server  core equinox-EasyBeans OSGI-EJB3 server  UML Profiles (Java, JPA, EJB3, Drools)  oAW Templates and Cartridges  MagicDraw DSL Customization + Editors  Riena for Remote OSGI Services  plus core ERP functionality (business modules)  first beta published in june 2009 98
  • 118. open-erp-ware.org (2)  slf4joverOSGI  LoggingBridge  could be used additional to SLF4J / LogBack Bridges 99
  • 119. redView - Riena EMF Dynamic Views  Open Source Dynamic Views for Business Applications  EMF  CDO  Ridgets  Prototyping  WYSIWYG Editor for dynamic SWT Views 100
  • 120. Question & Answer  ekke@ekkes-corner.org  Blog: http://ekkes-corner.org (en)  Blog: http://ekkes-ecke.org (de)  Video Podcasts: http://ekkes-corner-tv.org  Twitter: @ekkescorner  http://open-erp-ware.org  http://redview.org 101
  • 121. Video Podcast  you like to watch and hear this screencast as a Video Podcast ?  visit: http://ekkes-corner-tv.org  or search iTunes for „ekkes-corner“  (c) 2009 ekkehard gentz, eclipse public license EPL 102