View
5.962
Download
3
Category
Tags:
Preview:
DESCRIPTION
Using OSGi in enterprise applications: technologies, motivations, case studies.Presented at JaxItalia 2009, Milano, October 13th 2009
Citation preview
OSGi in the EnterpriseFilippo DiotaleviKnokode Ltd
filippo@diotalevi.com
OSGi in the Enterprise - Filippo Diotalevi
About
OSGi and Java Enterprise consultant
Java User Group Milano founder and coordinator
Apache Felix committer
http://www.diotalevi.com filippo@diotalevi.com
http://www.osgilook.com
OSGi in the Enterprise - Filippo Diotalevi
OSGi
OSGi in the Enterprise
Case Studies
OSGi - A developer’s quiickstartSaturday 11.30 - 12.00
Summary
OSGi in the Enterprise - Filippo Diotalevi
OSGi
A dynamic module system for Java
OSGi in the Enterprise - Filippo Diotalevi
OSGi
1999 - OSGi Alliance founded, JSR 8
2000 - R1 published
2003 - Eclipse choose OSGi for the plugin
architecture
2007 - R4.1 published (JSR 291)
2009 - R4.2 published
2010 - Enterprise OSGi
OSGi in the Enterprise - Filippo Diotalevi
OSGi
1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010
OSGi in the Enterprise - Filippo Diotalevi
OSGi
Building system from smaller components
Components working together
Managing components
OSGi in the Enterprise - Filippo Diotalevi
OSGi
Service Layer
Lifecycle Layer
Module Layer
OSGi in the Enterprise - Filippo Diotalevi
Module System
Clear boundaries
Dependencies
Metadata
Lifecycle
OSGi in the Enterprise - Filippo Diotalevi
Lifecycle of bundle
OSGi in the Enterprise - Filippo Diotalevi
Service System
Service Oriented Architecturein the JVM
OSGi in the Enterprise - Filippo Diotalevi
Bundle Provider Bundle Consumer
Service Registry
RegisterService
RetrieveService
Service System
OSGi in the Enterprise - Filippo Diotalevi
A collection of bundles interacting via Service interfaces
Bundles developed and installed independently
Bundle and services can appear and disappear
What’s an OSGi Application?
OSGi in the Enterprise - Filippo Diotalevi
Demo
OSGi in the Enterprise - Filippo Diotalevi
What’s behind the demo
Bundle Host
Provide the Frame and
define the Shape interface
Service Registry
Listen forand
retrieveShapes
Bundle Triangle
Provide the Triangle
implementation
Bundle Circle
Provide the Circle
implementation
RegisterTriangle
RegisterCircle
OSGi in the Enterprise - Filippo Diotalevi
OSGi in the Enterprise
Why?
Create modular and reusable software
Create evolvable software
Create line of products
OSGi in the Enterprise - Filippo Diotalevi
OSGi in the Enterprise
What?
Desktop Applications
Web Applications
Service Layers
Content Management System
Embedded/Mobile Applications
Cloud Applications
OSGi in the Enterprise - Filippo Diotalevi
Examples:
OSGi in the Enterprise - Filippo Diotalevi
OSGi in the Enterprise
How?Desktop Applications
♫
Eclipse
Rich Client Platform
OSGi in the Enterprise - Filippo Diotalevi
OSGi in the Enterprise
How?Web Applications
♫
Spring Dynamic ModulesApache Sling
Apache Felix Karaf + Pax Web (Jetty)
OSGi in the Enterprise - Filippo Diotalevi
Spring Dynamic Modules
Part of the Spring open source portfolio
Formerly known as Spring-OSGi
Works with every OSGi container
Allows you to implement Spring applicationson top of any OSGi framework
OSGi in the Enterprise - Filippo Diotalevi
Java Virtual Machine
OSGi Container
Spring + Spring DM
Application Context
Application Context
Application Context
Spring Bean
Exported Service
Imported Service
Bundle ABundle B
Bundle C
Spring DM idea
OSGi in the Enterprise - Filippo Diotalevi
One application context per bundle
When a bundle is started, its application contextis discovered and instantiated
Bundles can export Spring beans as OSGi services
Bundles can import OSGi services
Spring vs OSGi
OSGi in the Enterprise - Filippo Diotalevi
Blueprint Service
Blueprint, dependency injectiona-la-Spring
Apache Geronimo Blueprint (may change in the future...)
OSGi in the Enterprise - Filippo Diotalevi
OSGi in the Enterprise
How?Service Layers
♫
Spring Dynamic ModulesApache Felix
Apache ServicemixOSGi Remote Services
OSGi in the Enterprise - Filippo Diotalevi
Coming soon...
Enterprise OSGi
Full Web Application Support (RFC 66)
JDBC integration
JNDI/LDAP integration
.....
look for Apache Aries (http://incubator.apache.org/aries)
OSGi in the Enterprise - Filippo Diotalevi
OSGi in the Enterprise
Challenges and Opportunities
Modular Design
Development process and tools
Quality Assurance
Versioning and Dynamic Updates
Provisioning
OSGi in the Enterprise - Filippo Diotalevi
Case Studies
OSGi in the Enterprise - Filippo Diotalevi
Case Study 1: Service Layer
Goal
Create a service layer where services
- can be deployed/updated at runtime without causing service disruptions - can be customized for specific customers - (possibly) reusing some existing components
OSGi in the Enterprise - Filippo Diotalevi
Case Study 1: Service Layer
Solution: architecture
Generic REST API
WeatherService
NewsService
Embedded Jetty ServerPOJO -> XML transformation
Spring DMSpring
OSGi in the Enterprise - Filippo Diotalevi
Case Study 1: Service Layer
Solution: evolution
Generic REST API
WeatherService
NewsService V.2
NewsService
(BBC only)Twitter
OSGi in the Enterprise - Filippo Diotalevi
Case Study 1: Service Layer
Lessons learned
“Right” modularization is hard, and there is no fixed rule
Spring DM gets developers back in their confort zone (and hides OSGi APIs)
Deployment loves it (dynamicity, console, modularity)
OSGi in the Enterprise - Filippo Diotalevi
Case Study 2: OSGi in the Cloud
Goal
Manage completely the deployment of a Web Application in a cluster of Amazon virtual machines
Applications are modular, modules can be updated without causing service disruption
OSGi in the Enterprise - Filippo Diotalevi
Case Study 2: OSGi in the Cloud
Goal
“Cloud console” ?
OSGi in the Enterprise - Filippo Diotalevi
Case Study 2: OSGi in the Cloud
Solution: architecture
WebConsole
Amazon EC2 ClusterWeb Application based on Apache Felix Karaf
BundleRepository
UploadDefine packages
Start
Provision (SSH)
Load
Start
MySQL (Amazon EBS or RDS)
Start
Amazon Elastic Load Balancer
EC2
EBS/RDS
ELB
OSGi in the Enterprise - Filippo Diotalevi
Case Study 2: OSGi in the Cloud
OSGi in the Enterprise - Filippo Diotalevi
Case Study 3: Float management
Goal
Manage a float of Java-enabled devices
- check the software installed
- push software updates
OSGi in the Enterprise - Filippo Diotalevi
Case Study 3: Float management
Solution: Apache ACE
OSGi in the Enterprise - Filippo Diotalevi
Conclusion
OSGi is an enabling technology
that opens up new opportunities
OSGi in the Enterprise - Filippo Diotalevi
Questions?
Recommended