Más contenido relacionado Similar a Warum OSGi? (20) Más de Christian Baranowski (20) Warum OSGi?2. Willkommen
• Christian Baranowski
• Software Qualitätssicherung @ SEITENBAU Gmbh Konstanz (DE)
• Custom Software Solutions
• E-Government Solutions
• Identity Management and SSO Solutions
• www.seitenbau.de
• Vorstand OSGi Users' Forum Germany
• Co-lead (mit Jochen Hiller) German Enterprise Working Group.
• OSGi Code Camp
6. OSGi
A
Service
B
Modularity
Modules Lifecycle Services
7. OSGi
A
Service
B
Modularity
Modules Lifecycle Services
Security
13.
A
Service
B
Modularity
Modules Lifecycle Services
Security
39. Bundle
Manifest-Version: 1.0 Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-SymbolicName: A Bundle-SymbolicName: B
Bundle-Version: 1.0.1 Bundle-Version: 1.0.0
Export-Package: Import-Package:
echo.api;version=1.0.0, echo.api;version=[1.0,2),
echo.sysout;version=1.0.0 echo.sysout;version=[1.0,2)
43. Bundle
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: api
Bundle-Version: 2.0.0
Export-Package:
echo.api;version=1.0.0
45. Bundle Service
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: A
Bundle-Version: 1.0.1
API
46. Bundle
Import-Package:
echo.api;version=[1.0,2)
Service-Component:
OSGI-INF/EchoProvider.xml
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: api
Bundle-Version: 2.0.0
Export-Package:
echo.api;version=1.0.0
49. Bundle
Service
Manifest-Version: 1.0 Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-SymbolicName: A Bundle-SymbolicName: B
Bundle-Version: 1.0.1 Bundle-Version: 1.0.0
API
50. Bundle Import-Package:
Import-Package:
echo.api;version=[1.0,2) echo.api;version=[1.0,2)
Service-Component: Service-Component:
OSGI-INF/EchoProvider.xml OSGI-INF/EchoClient.xml
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: api
Bundle-Version: 2.0.0
Export-Package:
echo.api;version=1.0.0
54. Coupling
Manifest-Version: 1.0 Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-SymbolicName: A Bundle-SymbolicName: B
Bundle-Version: 1.0.1 Bundle-Version: 1.0.0
API
55. Bundle Import-Package:
Import-Package:
echo.api;version=[1.0,2) echo.api;version=[1.0,2)
Service-Component: Service-Component:
OSGI-INF/EchoProvider.xml OSGI-INF/EchoClient.xml
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: api
Bundle-Version: 2.0.0
Export-Package:
echo.api;version=1.0.0
56. Service Registry
Provider
Name Value
type api.Echo
- register availavility 5
- unregister
Consumer
Name Value - get
- listen
type api.Echo
availavility 5 Service Registry
... ...
66. Bundle
scr:component name=echo.consumer.EchoClient
scr:component name=echo.sysout.EchoProvider implementation class=echo.consumer.EchoClient/
implementation class=echo.sysout.EchoProvider/ reference name=Echo
service interface=echo.api.Echo
provide interface=echo.api.Echo / bind=setEcho unbind=unsetEcho /
/service /scr:component
/scr:component
69. Bundle
Service
import org.osgi...annotations.*;
import echo.api.Echo;
@Component
public class EchoClient {
API
70. Bundle
Echo echo;
import org.osgi.service.component.annotations.*;
import echo.api.Echo; @Reference
public void setEcho(Echo echo){
@Component this.echo = echo;
public class EchoProvider implements Echo { }
@Activate public void unsetEcho(Echo echo){
public void activate() { this.echo = null;
}
} }
}
74. Bundle
core-context.xml
blueprint
bean class=echo.consumer.EchoClient
API
75. Bundle property name=echo ref=echo /
/bean
/blueprint
77. Bundle
core-context.xml
blueprint
bean class=echo.consumer.EchoClient
API
78. Bundle property name=echo ref=echo /
/bean
/blueprint
osgi-context.xml
blueprint
reference id=echo
interface=echo.api.Echo/
/blueprint
81. Bundle
Service
core-context.xml
core-context.xml
blueprint
beans
context:component-scan bean class=echo.consumer.EchoClient
base-package=echo.sysout /
API
82. Bundle property name=echo ref=echo /
Spring
83. Proprietär
/beans /bean
/blueprint
@Component(echo)
public class EchoProvider implements Echo {
@PostConstruct
osgi-context.xml
public void init() { blueprint
}
} reference id=echo
interface=echo.api.Echo/
/blueprint
86. Bundle
Service
core-context.xml
core-context.xml
blueprint
beans
context:component-scan bean class=echo.consumer.EchoClient
base-package=echo.sysout /
API
87. Bundle property name=echo ref=echo /
Spring
88. Proprietär
/beans /bean
/blueprint
@Component(echo)
public class EchoProvider implements Echo {
@PostConstruct
osgi-context.xml
public void init() { blueprint
}
} reference id=echo
interface=echo.api.Echo/
osgi-context.xml /blueprint
blueprint
service ref=echo
interface=echo.api.Echo /
/blueprint
90. Provider
Name Value
type api.Echo
- register availavility 5
- unregister
Consumer
Name Value - get
- listen
type api.Echo
availavility 5 Service Registry
... ...
PojoSR
Pojo Service Registry
98. Bundle
service.exported.interfaces=*
102. Bundle
service.exported.interfaces=*
Distribution
Provider Impl. (ECF)
106. Bundle
service.exported.interfaces=*
listen
Distribution
Provider Impl. (ECF)
110. Bundle
service.exported.interfaces=*
listen
get
Distribution
Provider Impl. (ECF)
114. Bundle
service.exported.interfaces=*
endpoint
listen
get
Distribution
Provider Impl. (ECF)
119. service.exported.interfaces=*
endpoint service
listen
get
Distribution
Provider Impl. (ECF)
127. service.exported.interfaces=*
endpoint service
listen
get
Distribution
Provider Impl. (ECF)
135. service.exported.interfaces=*
endpoint service
listen
get
Distribution
Provider Impl. (ECF)
143. service.exported.interfaces=*
endpoint service
listen
register
get
Distribution
Provider Impl. (ECF)
151. service.exported.interfaces=*
endpoint service to
152. endpoint
listen
register
get
Distribution
Provider Impl. (ECF)
161.
service.exported.interfaces=* service
endpoint service to
162. endpoint
listen
register
get
Distribution
Provider Impl. (ECF)
166. Warum OSGi?
1. Modules, Extension, Plug-ins,
Plattformen
2. Services, Service Registry, Dynamik
Instance Coupling
3. Einfachere Entwicklung keine Restarts
167. “Warum OSGi?
... because it is a better way to develop
software ... “ - BJ Hargrave, IBM
Peter Kriens, aQute
169. Ressourcen
• OSGi Alliance
http://www.osgi.org/
• OSGi in Action (ISBN 1933988916)
Richard S. Hall, Karl Pauls, Stuart McCulloch, and David Savage
• Why OSGi?
BJ Hargrave (IBM), Peter Kriens (aQute)
http://www.slideshare.net/bjhargrave/why-osgi
• OSGi: Not Easy Enough to Use. Not as Productive as it Should Be,
Rod Johnson
http://www.theserverside.com/news/2240037102/OSGi-Not-Easy-Enough-
to-Use-Not-as-Productive-as-it-Should-Be
• Bndtools
http://bndtools.org/
• OSGi Demo Mars Robot Project
http://code.google.com/a/eclipselabs.org/p/occ/
• PojoSR
http://code.google.com/p/pojosr/