SlideShare uma empresa Scribd logo
1 de 75
Service-Oriented Component Model
Content 10/19/10 2 Service-Oriented Component Model 1 A Glance at OSGi 2 iPOJO & Service Binder 3 DS & Spring OSGi 4 Comparison 5 Summary 6
Service-Oriented Model 10/19/10 Publication Lookup Bind & Invoke ,[object Object],Service Registry Service  Consumer Service Provider Service Specification
Service-Oriented Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Service-Oriented Model ,[object Object],[object Object],[object Object],10/19/10 ,[object Object]
Component-Oriented Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Component-Oriented Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
SOC Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10 Business code Dynamic  management  code
SOC Model 10/19/10 Resolved at runtime Syntax, Description, Behavior, Semantic ,[object Object],Applications are build by using available services OSGi framework manage the component lifecycle
OSGi Platform ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
OSGi Platform ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
OSGi Platform ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Example 10/19/10 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],import tutorial.example2.service.DictionaryService; public class Activator implements BundleActivator { public void start(BundleContext context) { Properties props = new Properties(); props.put("Language", "English"); context.registerService( DictionaryService.class.getName(), new DictionaryImpl(), props); } public void stop(BundleContext context) { } private static class DictionaryImpl implements DictionaryService { String[] m_dictionary = { "welcome", "to", "the", "osgi", "tutorial" }; public boolean checkWord(String word) { .... } } } package tutorial.example2.service; public interface DictionaryService { public boolean checkWord(String word); } import org.osgi.framework.BundleActivator;import org.osgi.framework.BundleContext;import org.osgi.framework.ServiceReference; import org.osgi.framework.ServiceListener;import org.osgi.framework.ServiceEvent;
Motivation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10 19/10/10 Automate service registration & service dependency management
Existing Models ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
History 10/19/10 Service Binder (Humberto Cervantes) GenSD  Monolithic Approach close to ServiceBinder iPOJO 0.6 : Extensible component model, Hosted on APACHE iPOJO 0.7 : Refactoring, Composite … Declarative Service (OSGi™ R4) Dependency Manager (Marcel Offermans) Spring-OSGi™ (Interfaces 21) 2004 2005 2006 october june november february june september
10/19/10 a service component framework
iPOJO Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
iPOJO Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10 OSGi™ iPOJO
Concepts: Component ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Concepts: Lifecycle ,[object Object],[object Object],10/19/10 Configured Created INVALID Stopped VALID Destroyed
Concepts: Container ,[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10 Provided Service Lifecycle Configuration Architecture Dependency
Concepts: Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Concepts: Handlers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Dependency Handler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Dependency Handler 10/19/10
Architecture Handler  ,[object Object],[object Object],10/19/10 Component : fr.imag.adele.escoffier.hello.impl.HelloServiceImpl - VALID Dependency : org.osgi.service.log.LogService - RESOLVED - Optional : true - Multiple : false Provides : fr.imag.adele.escoffier.hello.HelloService - REGISTERED Service Property : floor_ = 2 Service Property : coucou = coucou Service Property : empty = true Service Property : language = fr Component : fr.imag.adele.escoffier.hello.impl.HelloServiceImpl2 - VALID Dependency : org.osgi.service.log.LogService - RESOLVED - Optional : true - Multiple : false Provides : fr.imag.adele.escoffier.hello.HelloService - REGISTERED
iPOJO Core Model 10/19/10
As Service Component ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Example ,[object Object],[object Object],[object Object],[object Object],10/19/10
Step 1 : the POJO classes ,[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Step 1 : the POJO classes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Step 2 : the Component Types ,[object Object],[object Object],[object Object],[object Object],10/19/10
Step 2 : the Component Types ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Step 3 : Component Instances ,[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Step 3 : Component Instances ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Step 4 : Packaging and Deployment ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10 <meta> {meta + manipulation} POJO POJO POJO POJO POJO iPOJO
Step 5 : Runtime 10/19/10 myFirstType mySecondType 2.1 instance 1.1 instance FooService Factory Factory
iPOJO Composition Level ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Structural Service Composition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Conclusion of iPOJO ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
10/19/10 Service Binder Simplifying application development on the OSGi services platform
Service Binder ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Execution Environment ,[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Concepts 10/19/10 an external view for the component and are part of the application logic  IOC pattern and execution environment can manage instance's lifecycle  deployment dependencies or resources
Instance Manager ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Instance Manager 10/19/10
Instance Property ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Instance Property =>Instance Manager ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Example: Step1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Step2~4 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10 3.- Activator package org.beanome.simpleclient.impl; import org.ungoverned.gravity.servicebinder.GenericActivator; public class Activator extends GenericActivator { }  4.- Service interfaces package org.simpleclient.interfaces; public interface SimpleClientService { ... }
Step5: Implement Class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Further Concepts ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Conclusion of Service Binder ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
10/19/10 Declarative Service
Declarative Service Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Declarative Service Overview 10/19/10
Declarative Service Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Declarative Service Overview ,[object Object],[object Object],10/19/10 Immediate Component Delayed Component Factory Component
Declarative Service Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Declarative Service  Examples ,[object Object],[object Object],[object Object],10/19/10 Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: ConfigFileValidatorBundle Bundle-SymbolicName: ConfigFileValidatorBundle Bundle-Version: 1.0.0 Bundle-ClassPath: bin/,lib/junit.jar Service-Component: OSGI-INF/component.xml Import-Package: org.osgi.framework;version=&quot;1.3.0 ……
Declarative Service  Examples 10/19/10 <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <component name=&quot;example.immediate&quot;> <implementation class=&quot;com.acme.USBConnectionImpl&quot;/> <service> <provide interface=&quot;com.acme.USBConnection&quot;/> </service> </component> package  com.acme; public class  USBConnectionImpl  implements  USBConnection { protected  void activate(ComponentContext ctxt) {...} protected  void activate(ComponentContext ctxt) {...} ... } /* Factory Component */ factory=“usbfactory” /* Delay Component */ immediate=“false”
Declarative Service  Examples 10/19/10 <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <component name=&quot;example.listen&quot;> <implementation class=&quot;com.acme.HttpResourceImpl&quot;/> <reference name=&quot;HTTP&quot; interface=&quot;org.osgi.service.http.HttpService&quot; cardinality=&quot;0..n&quot; bind=&quot;setPage&quot; unbind=&quot;unsetPage&quot;/> </component> package  com.acme; public class  HttpResourceImpl { protected  void setPage(HttpService http) { http.registerResources(&quot;/src&quot;, &quot;src&quot;, null ); } protected  void unsetPage(HttpService http) { http.unregister(&quot;/src&quot;); } } /* reference policy */ policy=“dynamic” /* filter */ taget=“(version=1.0)”
[object Object],10/19/10
Spring-OSGi Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Spring-OSGi Overview 10/19/10 ,[object Object],[object Object],[object Object],Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: ConfigFileValidatorBundle Bundle-SymbolicName: ConfigFileValidatorBundle Bundle-Version: 1.0.0 Bundle-ClassPath: bin/,lib/junit.jar Spring-Context: *;wait-for-dependencies=false Import-Package: org.osgi.framework;version=&quot;1.3.0 …… META-INF/spring
Spring-OSGi Overview ,[object Object],[object Object],10/19/10 <osgi:service interface =“com.xyz.MessageService&quot;> <bean class=“MessageServiceProvider”/> </osgi:service> <bean id =“MessageServiceProvider“  class=“com.xyz.MessageServiceImpl”/> </bean> lazy-init=“true”
Spring-OSGi Overview ,[object Object],[object Object],[object Object],10/19/10 <osgi:reference id=“MessageService“ interface=“com.xyz.MessageService”/> <bean id=“MyBean” class=“SomeClass”> <property name=“messageService” ref=“MessageService”/> </bean> public class  SomeClass { public  void setMessageService(MessageService s) { … } } cardinality=&quot;0..n“ filter=“(version=1.0)”
Spring-OSGi Overview ,[object Object],[object Object],10/19/10 <osgi:reference id=“MessageService“ interface=“com.xyz.MessageService”> <osgi:listener ref=“listenerBean” bind-method=“bind” unbind-method=“bind”/> </osgi:reference> <bean id=“listenerBean” class=“SomeClass”/> public class  SomeClass { public  void bind( MessageService  s) { … } public  void unbind( MessageService  s){ … } }
Spring-OSGi Overview ,[object Object],[object Object],10/19/10 <osgi:reference id=“MessageService“ interface=“com.xyz.MessageService” context-classloader=“client”> <osgi:listener ref=“listenerBean” bind-method=“bind” unbind-method=“bind”/> </osgi:reference> Service-provider Unmanaged(default)
Spring-OSGi Overview ,[object Object],[object Object],[object Object],[object Object],10/19/10
Comparison ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Comparison 10/19/10 ContextClassLoader Service Mngt Life Cycle Component Factory Composite Ext. & Open Container Arch. Service Binder 1.2 N Y Y Y  Y N Y Declarative Service N Y Y Y N N N Spring-OSGi Y Y y N N N N iPOJO 0.7 N
References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],10/19/10
Click to edit company slogan . We can always do better than good. Thank You !

Mais conteúdo relacionado

Semelhante a Service oriented component model

Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...
Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...
Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...
mfrancis
 
20090213 Friday Food Croslocis
20090213 Friday Food Croslocis20090213 Friday Food Croslocis
20090213 Friday Food Croslocis
imec.archive
 
20090213 Friday Food croslocis
20090213 Friday Food croslocis20090213 Friday Food croslocis
20090213 Friday Food croslocis
imec.archive
 

Semelhante a Service oriented component model (20)

Dynamic and modular Web Applications with Equinox and Vaadin
Dynamic and modular Web Applications with Equinox and VaadinDynamic and modular Web Applications with Equinox and Vaadin
Dynamic and modular Web Applications with Equinox and Vaadin
 
WJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJSWJAX 2012 - Web Apps With AngularJS
WJAX 2012 - Web Apps With AngularJS
 
Android101
Android101Android101
Android101
 
Flex for enterprise applications
Flex for enterprise applicationsFlex for enterprise applications
Flex for enterprise applications
 
Services Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJSServices Factory Provider Value Constant - AngularJS
Services Factory Provider Value Constant - AngularJS
 
OSGi DevCon 2009 Review
OSGi DevCon 2009 ReviewOSGi DevCon 2009 Review
OSGi DevCon 2009 Review
 
Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...
Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...
Keynote - The Benefits of an Open Service Oriented Architecture in the Enterpr...
 
Service Actions
Service ActionsService Actions
Service Actions
 
Moduarlity patterns with OSGi
Moduarlity patterns with OSGiModuarlity patterns with OSGi
Moduarlity patterns with OSGi
 
Spring training
Spring trainingSpring training
Spring training
 
20090213 Friday Food Croslocis
20090213 Friday Food Croslocis20090213 Friday Food Croslocis
20090213 Friday Food Croslocis
 
20090213 Friday Food croslocis
20090213 Friday Food croslocis20090213 Friday Food croslocis
20090213 Friday Food croslocis
 
James Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patterns
 
Liberate your components with OSGi services - Graham Charters
Liberate your components with OSGi services - Graham ChartersLiberate your components with OSGi services - Graham Charters
Liberate your components with OSGi services - Graham Charters
 
IBM Z for the Digital Enterprise 2018 - Offering API channel to application a...
IBM Z for the Digital Enterprise 2018 - Offering API channel to application a...IBM Z for the Digital Enterprise 2018 - Offering API channel to application a...
IBM Z for the Digital Enterprise 2018 - Offering API channel to application a...
 
Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?
 
Liberty Buildpack: Designed for Extension - Integrating your services in Blue...
Liberty Buildpack: Designed for Extension - Integrating your services in Blue...Liberty Buildpack: Designed for Extension - Integrating your services in Blue...
Liberty Buildpack: Designed for Extension - Integrating your services in Blue...
 
Revised Adf security in a project centric environment
Revised Adf security in a project centric environmentRevised Adf security in a project centric environment
Revised Adf security in a project centric environment
 
Microservices
MicroservicesMicroservices
Microservices
 
Opendelight reference-guide
Opendelight reference-guideOpendelight reference-guide
Opendelight reference-guide
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
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
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Service oriented component model

  • 2. Content 10/19/10 2 Service-Oriented Component Model 1 A Glance at OSGi 2 iPOJO & Service Binder 3 DS & Spring OSGi 4 Comparison 5 Summary 6
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. History 10/19/10 Service Binder (Humberto Cervantes) GenSD Monolithic Approach close to ServiceBinder iPOJO 0.6 : Extensible component model, Hosted on APACHE iPOJO 0.7 : Refactoring, Composite … Declarative Service (OSGi™ R4) Dependency Manager (Marcel Offermans) Spring-OSGi™ (Interfaces 21) 2004 2005 2006 october june november february june september
  • 17. 10/19/10 a service component framework
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 27.
  • 28. iPOJO Core Model 10/19/10
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38. Step 5 : Runtime 10/19/10 myFirstType mySecondType 2.1 instance 1.1 instance FooService Factory Factory
  • 39.
  • 40.
  • 41.
  • 42. 10/19/10 Service Binder Simplifying application development on the OSGi services platform
  • 43.
  • 44.
  • 45. Concepts 10/19/10 an external view for the component and are part of the application logic IOC pattern and execution environment can manage instance's lifecycle deployment dependencies or resources
  • 46.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 56.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62. Declarative Service Examples 10/19/10 <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <component name=&quot;example.immediate&quot;> <implementation class=&quot;com.acme.USBConnectionImpl&quot;/> <service> <provide interface=&quot;com.acme.USBConnection&quot;/> </service> </component> package com.acme; public class USBConnectionImpl implements USBConnection { protected void activate(ComponentContext ctxt) {...} protected void activate(ComponentContext ctxt) {...} ... } /* Factory Component */ factory=“usbfactory” /* Delay Component */ immediate=“false”
  • 63. Declarative Service Examples 10/19/10 <?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?> <component name=&quot;example.listen&quot;> <implementation class=&quot;com.acme.HttpResourceImpl&quot;/> <reference name=&quot;HTTP&quot; interface=&quot;org.osgi.service.http.HttpService&quot; cardinality=&quot;0..n&quot; bind=&quot;setPage&quot; unbind=&quot;unsetPage&quot;/> </component> package com.acme; public class HttpResourceImpl { protected void setPage(HttpService http) { http.registerResources(&quot;/src&quot;, &quot;src&quot;, null ); } protected void unsetPage(HttpService http) { http.unregister(&quot;/src&quot;); } } /* reference policy */ policy=“dynamic” /* filter */ taget=“(version=1.0)”
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73. Comparison 10/19/10 ContextClassLoader Service Mngt Life Cycle Component Factory Composite Ext. & Open Container Arch. Service Binder 1.2 N Y Y Y Y N Y Declarative Service N Y Y Y N N N Spring-OSGi Y Y y N N N N iPOJO 0.7 N
  • 74.
  • 75. Click to edit company slogan . We can always do better than good. Thank You !

Notas do Editor

  1. SOA
  2. Dynamic nature: they can be registered/unregistered to/from the service registry at any moment and the client must be prepared to cope with this situation, i.e. some notification. A service requester must be prepared to cope with situations where no required services are found or, on the other hand, multiple matching services are found. service requesters do not directly instantiate service instances, as is the case in object orientation, for example. As a result, service requesters do not know whether they are interacting with a common service instance or with different instances providing the same service.
  3. Need a way to help architects to design service applications Need an easy programming model to develop applications using services
  4. A typical view of components is that they implement one or more provided interfaces, where an interface is a contract of functional behavior. In this sense, interfaces provided by components are very similar to service interfaces. This makes components an ideal candidate for implementing services, where a service is equated with a provided interface.
  5. Compositions are expressed in term of service specifications Applications are build by using available services
  6. a service platform that includes a minimal component model, a small framework for managing the components, and a service registry. Services (i.e.,Java interfaces) are packaged along with their implementations and their associated resources into bundles . Services are deployed, as bundles. The OSGi framework creates a host environment for managing bundles and the services they provide; a bundle is the physical unit of deployment in OSGi and is also a logical concept used by the framework to internally represent the service implementation. The management mechanisms provided by the framework allow for the installation, activation, deactivation, update, and removal of bundles.
  7. The activator implements activation and deactivation methods that are called to initialize and de-initialize it, respectively. In the activation/deactivation methods the activator receives a context object, which gives it access to the framework and the service registry. The context allows the activator component to register services, lookfor other services, and register itself as a listener to different types of events that the framework may fire.
  8. The state of a bundle can change at any moment while the framework is running. When a bundle is stopped, its associated activator component must unregister its services and release the services that it is using. Clients of the activator component&apos;s services must take care to observe the departure of the services. The OSGi framework uses event notifications to signal service arrival and departure, but does not provide any additional support for service dependency management. Two classes of service dependencies exist in OSGi: component to-service and service-to-service. A component-to-service dependency occurs when a component depends on a service without itself providing any services. A service-to-service dependency occurs when a component provides services and also requires other services to provide its own. Writing the code tomanage component-to-service and service-to-service dependencies is complex and error-prone; managing service dependencies involves concurrency and synchronization issues as well as tedious code to monitor the arrival and departure of any used services. Monitoring involves the observation of changes in the service registry. This is done through the reception of notifications produced by the service registry that announce arrival, departure or changes in the servies. Reconfiguration involves acting in response to the changes in the services. Reconfiguration includes the release of a departing service but also the creation of a new binding towards a substituting or newly arriving service.
  9. iPOJO is a service component runtime aiming to simplify OSGi application development. Based on the concept of POJO, application logic is developped easily. Non functional properties are injected in the component at runtime. iPOJO strength points are : components are developped as POJO the component model is extensible the standard component model manages service providing and service dependencies iPOJO manage the component lifecycle and the environment dynamics
  10. A POJO is a very simple Java class containing only the business logic. A POJO has not dependencies on its execution environment. In iPOJO, a POJO is a Java class which serve of implementation to a component type. As a content of a component, non-functional requirements of this class will be injected by the container.
  11. a component type is described by an implementation class and a container configuration. This container configuration describes non-functional requirements of the implementation / component type. For example, the container description can declare that fields are service dependencies, that it provides a service...
  12. A handler is an object who can be plugged on an instance container. A handler manages one non-functional requirement of the instances. Handler can be created and deployed separately from the iPOJO runtime. So everybody can implement its own handler. It is possible to extend the component model by creating your own handler. Service dependency handler managing OSGi service discovery and invocation Service Providing handler managing the publication and the providing of OSGi services Lifecycle callback handler allowing the invocation of methods when the instance state changes Configuration Handler allowing the configuration and the dynamic reconfiguration of the instance Architecture Handler allowing to get information about the instance (state, handler ...) Lifecycle Invoke a method when the instance becomes valid or invalid Configuration Admin support Allow to dynamically (re-) configure an instance with the configuration admin Architecture view Allow to view instance and handlers information External handlers mechanism Allow to add non functional concerns in the component model Persistency Connectors : Event admin / Wire admin Configuration : JMX Task management : Cron, TaskScheduler Security … Easy to develop and to deploy
  13. In fact, the container of the component contains a &amp;quot;Dependencies Manager&amp;quot; managing all the service dependency of the component. To do this, it registers an OSGi service event listener and listens for interesting events. When an interesting service arrives, it stores the service reference. When the service is used, it obtains the service object and returns the object to the component. If it is a multiple dependencies, it returns an array of service object. When a service goes away, the dependencies manager removes the reference from its list (and call the unget method): the manager does not keep any reference on the old service. This allows a complete unloading of the service. Two calls to a service can use two different service implementations if the used implementation has gone. iPOJO tries to return always the same service object, since the service goes away.
  14. Field : name of the field reprensenting the dependency in the component class Interface : type of the field Optional : is the dependency an optional dependency ? Filter : filter selecting service provider Callback : allow to call a method on the component instances when a service provider (matching with the dependency) appears or disappears
  15. POJO provides an ADL based of the notion of services. This kind of &amp;quot;composition&amp;quot; can be named Structural Service Composition. Generally, the application is described in terms of components or instances. iPOJO compositions are described in term of services. This composition allows more flexibility and allows service implementations to evolve without breaking the composition. As a composition can export/implement a service, a composition can be used inside another composition transparently. This brings a hierarchical composition model. Moreover, as the rest of iPOJO the composition is extensible via &amp;quot;composite handler&amp;quot;, which are handler participating to a composition.
  16. During execution, every component instance is managed independently by an instance manager that takes in charge service registration and service dependency management activities based on the information present in the component descriptor. The instance manager is a container that manages the instance&apos;s life-cycle through control methods and interfaces, which are only visible to the instance manager, following the Inversion of Control pattern (see figure 1).
  17. A component instance is in one of two states: valid or invalid . When an instance is valid, its services are registered in the service registry and it is active (i.e., executing). When an instance is invalid, its services are not registered in the service registry and it is not active. When an instance is created, it is initially invalid. After creation, the instance manager enters a configuration phase (see figure 2). At this point, it creates bindings between the instance it manages and other instances that provide services required by the managed instance. Configuration can only succeed if bindings can be created for required service interfaces that are categorized as being mandatory. After configuration, the instance manager activates the component instance, and registers its services in the service registry. At that point the instance is valid. If configuration fails, the instance manager waits for the arrival of services that can be used to configure the instance. As soon as all mandatory services become present, the instance is validated. During execution, the instance manager receives notifications from the service registry. These notifications can trigger re-configuration activities, which depend on the dependency properties associated to the component that is being managed. The behavior of the instance manager with respect to the service dependency properties is summarized .
  18. A static binding policy indicates that dependency bindings cannot change at run time, whereas a dynamic binding policy indicates that dependency bindings can change at run time. A static dependency is simpler to program than a dynamic one. 1..1, static Instance is bound to one service, any change invalidates the instance 1..1, dynamic Instance is bound to one service, changes do not invalidate the instance as long as it can be bound to another service 1..n, static Instance is bound to at least one service, any change invalidates the instance 1..n, dynamic Instance is bound to at least one service, changes do not invalidate the instance as long as the binding count is non-zero 0..1, static Instance is bound to at most one service (i.e., optional), if it is bound, departure of the bound service invalidates the instance 0..1, dynamic Instance is bound to at most one service (i.e., optional), the instance never becomes invalid 0..n, static Instance is bound to all available services at the time of binding, any departure of a bound service invalidates the instance 0..n, dynamic Instance is bound to all available services at the time of binding, as services arrive/depart they are bound/unbound to/from the instance, the instance never becomes invalid
  19. bind-method: The name of the method to call on the component instance to bind a service to it. 􀀀 unbind-method: The name of the method that to call on the component instance to unbind a service from it.
  20. When multiple required services are declared, it may be necessary for the component instance to be notified when the configuration phase is finished. Similarly, it may be necessary to be notified when the component instance is about to be invalidated (versus a re-configuration). This is the purpose of the methods defined in the Lifecycle interface. If the component implementation class implements this interface, the following methods are called at two different moments: activate(): During configuration, after all the bindings have been created, but before the provided services are registered. deactivate(): During execution, when the instance is about to be invalidated, after its services are unregistered and before its bindings are destroyed. ServiceBinderContext When writing an the component implementation class, it may be necessary to access the OSGi&apos;s bundle context that is provided to the activator of the bundle (altough this is usually not necessary). ServiceBinderContext is a class provided to solve this issue. If the instance class constructor receives a single ServiceBinderContext parameter, a context will be passed into it during instantiation. The methods that are provided in this context allow to: Access the bundle&apos;s BundleContext. Obtain the InstanceReference object corresponding to this instance. Obtain a list of all of the instance references that belong to the bun protected Object proxyProvidedServiceObject(Object obj, InstanceMetadata metadata) protected Object proxyRequiredServiceObject(Object obj, DependencyMetadata metadata) The first parameter of both methods contains the object to which a proxy will be added. The first method is called right after the component instance is created. The InstanceMetadata passed as a parameter provides the information about the component found on the descriptor file. The second method is called right before an invocation to a bind method takes place. The DependencyMetadata passed as a parameter contains information about the dependency such as the filter and the name of the service.