SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
What's cool in the new and updated OSGi specs

What's cool in the new and updated

OSGi Specs
Carsten Ziegeler
David Bosschaert

1 of 50
What's cool in the new and updated OSGi specs

Speakers
David Bosschaert (david@redhat.com)
JBoss/Fuse at Red Hat
Co-chair OSGi EEG
Open-source and cloud enthusiast
Carsten Ziegeler (cziegeler@apache.org)
RnD Adobe Research Switzerland
OSGi CPEG and EEG Member
ASF member

2 of 50
What's cool in the new and updated OSGi specs

Agenda
Framework updates
OSGi/CDI integration
Repository update
Declarative Services
Http Service
Cloud
Portable Java Contracts
Semantic Versioning Annotations
Other spec updates

3 of 50
What's cool in the new and updated OSGi specs

Framework Updates
Service Scopes (RFC 195)

Service Scopes: singleton, bundle, prototyp
Driver: Support for EEG specs (EJB, CDI)
Usage in other spec updates
New PrototypeServiceFactory

4 of 50
What's cool in the new and updated OSGi specs

PrototypeServiceFactory
public interface PrototypeServiceFactory <S>
extends ServiceFactory <S> {
S getService(Bundle bundle,
B
ServiceRegistration <S> registration);
void ungetService(Bundle bundle,
B
ServiceRegistration <S> registration,
S service);
}

5 of 50
What's cool in the new and updated OSGi specs

New method in BundleContext:
public interface BundleContext {
<S> ServiceObjects <S> getServiceObjects(ServiceReference <S> ref);
S
}

New Interface ServiceObjects:
public interface ServiceObjects <S> {
S getService();
void ungetService(S service);
}

6 of 50
What's cool in the new and updated OSGi specs

Data
Transfer
Objects

7 of 50
What's cool in the new and updated OSGi specs

RFC 185 – Data Transfer Object
Defines a DTO model for OSGi
Serializable/Deserializable objects

Use cases: REST, JMX, Web Console...
To be adopted by other specs

8 of 50
What's cool in the new and updated OSGi specs

RFC 185 – Data Transfer Object
Getting DTOs: adapter pattern
public class BundleDTO extends org.osgi.dto.DTO {
public long id;
public long lastModified;
public int state;
public String symbolicName;
public String version;
}

9 of 50
What's cool in the new and updated OSGi specs

RFC 185 – Data Transfer Object
DTOs for the OSGi framework
FrameworkDTO
BundleDTO

ServiceReferenceDTO
BundleStartLevelDTO, FrameworkStartLevel

CapabilityDTO, RequirementDTO, Resource
BundleWiringsDTO, etc

10 of 50
What's cool in the new and updated OSGi specs

OSGi/CDI
integration

11 of 50
What's cool in the new and updated OSGi specs

RFC 193 - CDI Support
Bridging OSGi and standard JavaEE
dependency model
● Publishing CDI beans as OSGi services
● Injecting OSGi services in CDI beans
CDI = Contexts and dependency injection

12 of 50
What's cool in the new and updated OSGi specs

RFC 193 - Examples
● Publishing CDI bean as OSGi service
@Component
public class MyComponent implements MyInterface { ... }

● Dependency Injection
@Inject
@Service
private MyInterface serviceA;
@Inject
@Service(optional = true )
private MyInterface serviceB;

13 of 50
What's cool in the new and updated OSGi specs

Repository
1.1

14 of 50
What's cool in the new and updated OSGi specs

OSGi Repository today

15 of 50
What's cool in the new and updated OSGi specs

Example Repository namespaces

16 of 50
What's cool in the new and updated OSGi specs

RFC 187 - Repository 1.1
Existing repository powerful
but: limited to queries in a single namespace
New in RFC 187:
Combine requirements spanning multiple namespaces:
Repository repo = ... // Obtain from Service Registry
Collection <Resource > res = repo.findProviders(
R
repo.getExpressionCombiner().and(
a
repo.newRequirementBuilder("osgi.wiring.package").
addDirective("filter","(osgi.wiring.package=foo.pkg1)").
buildExpression(),
repo.newRequirementBuilder("osgi.identity").
addDirective("filter",
"(license=http://opensource.org/licenses/Apache-2.0)").
buildExpression()));

17 of 50
What's cool in the new and updated OSGi specs

Declarative
Services

18 of 50
What's cool in the new and updated OSGi specs

RFC 190 - Declarative Services
Enhancements
Support of service scopes
Diagnostic API
DTOs
But most importantly...

19 of 50
What's cool in the new and updated OSGi specs

Use annotations for
configuration...
@interface MyConfig {
boolean enabled() default true ;
String [] topic() default {"topicA", "topicB"};
String userName();
int service_ranking() default 15;
}

20 of 50
What's cool in the new and updated OSGi specs

...and reference them in
lifecycle methods
@Component
public class MyComponent {
String userName;
String [] topics;
@Activate
protected void activate(final MyConfig config) {
f
if ( config.enabled() ) {
this .userName = config.userName();
this .topics = config.topic();
}
}
}

21 of 50
What's cool in the new and updated OSGi specs

...or even simpler...
@Component
public class MyComponent {
private MyConfig configuration;
@Activate
protected void activate(final MyConfig config) {
f
if ( config.enabled() ) {
this .configuration = config;
}
}
}

22 of 50
What's cool in the new and updated OSGi specs

Annotation Mapping
Fields registered as component
properties
Name mapping (_ -> .)
Type mapping for configurations

23 of 50
What's cool in the new and updated OSGi specs

Mapping
@interface MyConfig {
boolean enabled() default true ;
String [] topic() default {"topicA", "topicB"};
String userName();
int service_ranking() default 15;
}

24 of 50
What's cool in the new and updated OSGi specs

RFC 190 - Declarative Services
Enhancements
Annotation configuration support
Support of service scopes
Diagnostic API
DTOs

25 of 50
What's cool in the new and updated OSGi specs

HTTP
Service

26 of 50
What's cool in the new and updated OSGi specs

RFC 189 - Http Service
Update
Update to Servlet API 3+
Whiteboard support for
Servlets, Servlet Filters
Listeners, Resources and HttpContexts
and DTOs

27 of 50
What's cool in the new and updated OSGi specs

Whiteboard Servlet Registration
@Component(service = javax.servlet.Servlet .class ,
S
c
scope="PROTOTYPE",
property ={
"osgi.http.whiteboard.servlet.pattern=/products/*",
})
public class MyServlet extends HttpServlet {
...
}

28 of 50
What's cool in the new and updated OSGi specs

Whiteboard Servlet Filter
Registration
@Component(service = javax.servlet.Filter .class ,
F
c
scope="PROTOTYPE",
property ={
"osgi.http.whiteboard.filter.pattern=/products/*",
})
public class MyFilter implements Filter {
...
}

29 of 50
What's cool in the new and updated OSGi specs

Additional Support
Most listener types are supported
Register with their interface
Error Pages and Resources
Shared HttpContexts
Target Http Service

30 of 50
What's cool in the new and updated OSGi specs

Cloud

31 of 50
What's cool in the new and updated OSGi specs

Current PaaS offerings...

32 of 50
What's cool in the new and updated OSGi specs

OSGi Cloud Ecosystems PaaS

33 of 50
What's cool in the new and updated OSGi specs

An OSGi cloud ecosystem...
Many frameworks
○ hosting a variety of deployments

Together providing The Application
Not a bunch of replicas
○ rather a collection of different nodes
○ with different roles working together
○ some may be replicas

Load varies over time
... and so does your cloud system
○ topology
○ configuration
○ number of nodes
○ depending on the demand

34 of 50
What's cool in the new and updated OSGi specs

To realize this you need...
Information!
○ need to know what nodes are available
○ ability to react to changes

Provisioning capability
Remote invocation
○ inside your cloud system
○ to get nodes to communicate
○ either directly...
○ ... or as a means to set up communication channels

35 of 50
What's cool in the new and updated OSGi specs

RFC 183 - Cloud Ecosystems
FrameworkNodeStatus service:
information about each Cloud node
accessible as a Remote Service
throughout the ecosystem

Information such as:
Hostname/IP address
Location (country etc)
OSGi and Java version running
A REST management URL
Runtime metadata
Available memory / disk space
Load measurement

... you can add custom metadata too ...

36 of 50
What's cool in the new and updated OSGi specs

FrameworkNodeStatus service properties
37 of 50
What's cool in the new and updated OSGi specs

RFC 182 - REST API
A cloud-friendly remote management API
works great with FrameworkNodeStatus
Example:
addingService(ServiceReference <FrameworkNodeStatus > ref) {
S
F
// A new Node became available
String url = ref.getProperty("org.osgi.node.rest.url");
RestClient rc = new RestClient (new URI(url));
n

// Provision the new node
rc.installBundle(...);
rc.startBundle(...);
}

38 of 50
What's cool in the new and updated OSGi specs

Additional ideas in RFC 183
Special Remote Services config type
・ osgi.configtype.ecosystem

・ defines supported Remote Service data types
・ not visible outside of cloud system

Ability to intercept remote service calls
・ can provide different service for each client
・ can do invocation counting (quotas, billing)

Providing remote services meta-data
・ quota exceeded
・ payment needed

・ maintenance scheduled

39 of 50
What's cool in the new and updated OSGi specs

Current OSGi cloud work
Provides a base line
○ to build fluid cloud systems
○ portability across clouds
Where everything is dynamic
○ nodes can be repurposed
... and you deal with your cloud nodes
through OSGi services

40 of 50
What's cool in the new and updated OSGi specs

Portable
Java
Contracts

41 of 50
What's cool in the new and updated OSGi specs

Semantic Versioning...
... is a versioning policy for exported packages.
OSGi versions: <major>.<minor>.<micro>.<qualifier>
Updating package versions:
● fix/patch (no change to API):
update micro
● extend API (affects implementers, not clients):
update minor
● API breakage:
update major
Note: not always used for bundle versions

42 of 50
What's cool in the new and updated OSGi specs

Semantic Versioning is great, but...
- not all projects use it, e.g. APIs from JSRs
- e.g. Servlet 3 is backward compatible with 2.5
- what's its javax.servlet package version?
2.6 ?
or 3.0 ?

- different projects made different choices

43 of 50
What's cool in the new and updated OSGi specs

RFC 180: Portable Java Contracts
osgi.contract capability to the rescue
● client bundle requires capability
with 'marketing' or 'spec' version

● and also imports the package without version

osgi.contract provider binds the contract version to package versions
Import -Package : javax.servlet, javax.servlet.http
P
Require -Capability : osgi.contract;
C
filter:="(&(osgi.contract=JavaServlet)(version=3.0))"

Allows writing portable bundles that import non-semant
versioned packages.

44 of 50
What's cool in the new and updated OSGi specs

Type and
Package
Annotations

45 of 50
What's cool in the new and updated OSGi specs

RFC 197 – OSGi Type and
Package Annotations
Annotations for documenting semantic
versioning information
Class retention annotations

@Version
@ProviderType
@ConsumerType

46 of 50
What's cool in the new and updated OSGi specs

Other
Enterprise
Spec
updates
47 of 50
What's cool in the new and updated OSGi specs

▻ Blueprint 1.1

・ Non-damped service references
・ Grace period enhancements
・ Many small fixes

▻ Remote Service Admin 1.1

・ Remote Service registration modification

▻ Subsystems 1.1

・ Provide Deployment Manifest separately
・ Many small enhancements

48 of 50
What's cool in the new and updated OSGi specs

When can I get it?
RFCs available to everyone today:
https://github.com/osgi/design
(https://github.com/osgi/design)
◎ Most work aimed at Core/Enterprise R6 (2014)
◎ Some specs in Enterprise R7 (2015)

49 of 50
What's cool in the new and updated OSGi specs

Questions?

50 of 50

Más contenido relacionado

La actualidad más candente

Apache Aries Overview
Apache Aries   OverviewApache Aries   Overview
Apache Aries Overview
Ian Robinson
 
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
mfrancis
 
Netty 4-based RPC System Development
Netty 4-based RPC System DevelopmentNetty 4-based RPC System Development
Netty 4-based RPC System Development
Allan Huang
 

La actualidad más candente (20)

OSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian SchneiderOSGi ecosystems compared on Apache Karaf - Christian Schneider
OSGi ecosystems compared on Apache Karaf - Christian Schneider
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
OSGi in 5 minutes
OSGi in 5 minutesOSGi in 5 minutes
OSGi in 5 minutes
 
Apache Aries Overview
Apache Aries   OverviewApache Aries   Overview
Apache Aries Overview
 
OSGi Presentation
OSGi PresentationOSGi Presentation
OSGi Presentation
 
Benefits of OSGi in Practise
Benefits of OSGi in PractiseBenefits of OSGi in Practise
Benefits of OSGi in Practise
 
Monitoring OSGi Applications with the Web Console - Carsten Ziegeler
Monitoring OSGi Applications with the Web Console - Carsten ZiegelerMonitoring OSGi Applications with the Web Console - Carsten Ziegeler
Monitoring OSGi Applications with the Web Console - Carsten Ziegeler
 
GraphTour - Utilizing Powerful Extensions for Analytics & Operations
GraphTour - Utilizing Powerful Extensions for Analytics & OperationsGraphTour - Utilizing Powerful Extensions for Analytics & Operations
GraphTour - Utilizing Powerful Extensions for Analytics & Operations
 
Language Enhancement in ColdFusion 8 - CFUnited 2007
Language Enhancement in ColdFusion 8 - CFUnited 2007Language Enhancement in ColdFusion 8 - CFUnited 2007
Language Enhancement in ColdFusion 8 - CFUnited 2007
 
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
What’s cool in the new and updated OSGi specs (DS, Cloud and more) - David Bo...
 
Building Netty Servers
Building Netty ServersBuilding Netty Servers
Building Netty Servers
 
Node.js 1, 2, 3
Node.js 1, 2, 3Node.js 1, 2, 3
Node.js 1, 2, 3
 
Spring 4 final xtr_presentation
Spring 4 final xtr_presentationSpring 4 final xtr_presentation
Spring 4 final xtr_presentation
 
Netty 4-based RPC System Development
Netty 4-based RPC System DevelopmentNetty 4-based RPC System Development
Netty 4-based RPC System Development
 
Spring 4 advanced final_xtr_presentation
Spring 4 advanced final_xtr_presentationSpring 4 advanced final_xtr_presentation
Spring 4 advanced final_xtr_presentation
 
Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)
 
Python at Facebook
Python at FacebookPython at Facebook
Python at Facebook
 
.NET Core, ASP.NET Core Course, Session 5
.NET Core, ASP.NET Core Course, Session 5.NET Core, ASP.NET Core Course, Session 5
.NET Core, ASP.NET Core Course, Session 5
 
Automated testing web services - part 1
Automated testing web services - part 1Automated testing web services - part 1
Automated testing web services - part 1
 
Java Play Restful JPA
Java Play Restful JPAJava Play Restful JPA
Java Play Restful JPA
 

Similar a What's cool in the new and updated OSGi Specs (2013)

Going Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha ZelzerGoing Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha Zelzer
mfrancis
 

Similar a What's cool in the new and updated OSGi Specs (2013) (20)

What's cool in the new and updated OSGi Specs (EclipseCon 2014)
What's cool in the new and updated OSGi Specs (EclipseCon 2014)What's cool in the new and updated OSGi Specs (EclipseCon 2014)
What's cool in the new and updated OSGi Specs (EclipseCon 2014)
 
What's cool in the new and updated OSGi specs
What's cool in the new and updated OSGi specsWhat's cool in the new and updated OSGi specs
What's cool in the new and updated OSGi specs
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data center
 
Frankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGiFrankenstein's IDE: NetBeans and OSGi
Frankenstein's IDE: NetBeans and OSGi
 
Introduction to OSGGi
Introduction to OSGGiIntroduction to OSGGi
Introduction to OSGGi
 
Neo4j Vision and Roadmap
Neo4j Vision and Roadmap Neo4j Vision and Roadmap
Neo4j Vision and Roadmap
 
DS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham ChartersDS, BP, EJB, CDI, WTF!? - Graham Charters
DS, BP, EJB, CDI, WTF!? - Graham Charters
 
What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0What's new in the OSGi Enterprise Release 5.0
What's new in the OSGi Enterprise Release 5.0
 
optimizing_ceph_flash
optimizing_ceph_flashoptimizing_ceph_flash
optimizing_ceph_flash
 
AtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMSAtoZ about TYPO3 v8 CMS
AtoZ about TYPO3 v8 CMS
 
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
[Rakuten TechConf2014] [C-5] Ichiba Architecture on ExaLogic
 
EnhancingOSGi with Explicit, Vendor Independent Extra-functional Properties
EnhancingOSGi with Explicit, Vendor Independent Extra-functional PropertiesEnhancingOSGi with Explicit, Vendor Independent Extra-functional Properties
EnhancingOSGi with Explicit, Vendor Independent Extra-functional Properties
 
Java one2013
Java one2013Java one2013
Java one2013
 
Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019
 
Going Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha ZelzerGoing Native With The OSGi Service Layer - Sascha Zelzer
Going Native With The OSGi Service Layer - Sascha Zelzer
 
OSDC 2018 | Katello: Adding content management to Foreman by Dirk Götz
OSDC 2018 | Katello: Adding content management to Foreman by Dirk GötzOSDC 2018 | Katello: Adding content management to Foreman by Dirk Götz
OSDC 2018 | Katello: Adding content management to Foreman by Dirk Götz
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
Presto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performancePresto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performance
 
Steeltoe Meetup Toronto 4-18-2017
Steeltoe Meetup Toronto 4-18-2017Steeltoe Meetup Toronto 4-18-2017
Steeltoe Meetup Toronto 4-18-2017
 
HPC on OpenStack
HPC on OpenStackHPC on OpenStack
HPC on OpenStack
 

Más de David Bosschaert

What's new in the OSGi 4.2 Enterprise Release
What's new in the OSGi 4.2 Enterprise ReleaseWhat's new in the OSGi 4.2 Enterprise Release
What's new in the OSGi 4.2 Enterprise Release
David Bosschaert
 

Más de David Bosschaert (11)

Node MCU Fun
Node MCU FunNode MCU Fun
Node MCU Fun
 
Provisioning with OSGi Subsystems and Repository using Apache Aries and Felix
Provisioning with OSGi Subsystems and Repository using Apache Aries and FelixProvisioning with OSGi Subsystems and Repository using Apache Aries and Felix
Provisioning with OSGi Subsystems and Repository using Apache Aries and Felix
 
OSGi Cloud Ecosystems (EclipseCon 2013)
OSGi Cloud Ecosystems (EclipseCon 2013)OSGi Cloud Ecosystems (EclipseCon 2013)
OSGi Cloud Ecosystems (EclipseCon 2013)
 
OSGi Enterprise Expert Group (OSGi Users Forum Germany)
OSGi Enterprise Expert Group (OSGi Users Forum Germany)OSGi Enterprise Expert Group (OSGi Users Forum Germany)
OSGi Enterprise Expert Group (OSGi Users Forum Germany)
 
OSGi Cloud Ecosystems (OSGi Users Forum Germany)
OSGi Cloud Ecosystems (OSGi Users Forum Germany)OSGi Cloud Ecosystems (OSGi Users Forum Germany)
OSGi Cloud Ecosystems (OSGi Users Forum Germany)
 
OSGi Cloud Ecosystems
OSGi Cloud EcosystemsOSGi Cloud Ecosystems
OSGi Cloud Ecosystems
 
OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)OpenJDK Penrose Presentation (JavaOne 2012)
OpenJDK Penrose Presentation (JavaOne 2012)
 
Update on the OSGi Enterprise Expert Group
Update on the OSGi Enterprise Expert GroupUpdate on the OSGi Enterprise Expert Group
Update on the OSGi Enterprise Expert Group
 
What's new in the OSGi 4.2 Enterprise Release
What's new in the OSGi 4.2 Enterprise ReleaseWhat's new in the OSGi 4.2 Enterprise Release
What's new in the OSGi 4.2 Enterprise Release
 
Distributed Services - OSGi 4.2 and possible future enhancements
Distributed Services - OSGi 4.2 and possible future enhancementsDistributed Services - OSGi 4.2 and possible future enhancements
Distributed Services - OSGi 4.2 and possible future enhancements
 
Distributed OSGi Demo Eclipsecon 2009
Distributed OSGi Demo Eclipsecon 2009Distributed OSGi Demo Eclipsecon 2009
Distributed OSGi Demo Eclipsecon 2009
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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)
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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...
 

What's cool in the new and updated OSGi Specs (2013)

  • 1. What's cool in the new and updated OSGi specs What's cool in the new and updated OSGi Specs Carsten Ziegeler David Bosschaert 1 of 50
  • 2. What's cool in the new and updated OSGi specs Speakers David Bosschaert (david@redhat.com) JBoss/Fuse at Red Hat Co-chair OSGi EEG Open-source and cloud enthusiast Carsten Ziegeler (cziegeler@apache.org) RnD Adobe Research Switzerland OSGi CPEG and EEG Member ASF member 2 of 50
  • 3. What's cool in the new and updated OSGi specs Agenda Framework updates OSGi/CDI integration Repository update Declarative Services Http Service Cloud Portable Java Contracts Semantic Versioning Annotations Other spec updates 3 of 50
  • 4. What's cool in the new and updated OSGi specs Framework Updates Service Scopes (RFC 195) Service Scopes: singleton, bundle, prototyp Driver: Support for EEG specs (EJB, CDI) Usage in other spec updates New PrototypeServiceFactory 4 of 50
  • 5. What's cool in the new and updated OSGi specs PrototypeServiceFactory public interface PrototypeServiceFactory <S> extends ServiceFactory <S> { S getService(Bundle bundle, B ServiceRegistration <S> registration); void ungetService(Bundle bundle, B ServiceRegistration <S> registration, S service); } 5 of 50
  • 6. What's cool in the new and updated OSGi specs New method in BundleContext: public interface BundleContext { <S> ServiceObjects <S> getServiceObjects(ServiceReference <S> ref); S } New Interface ServiceObjects: public interface ServiceObjects <S> { S getService(); void ungetService(S service); } 6 of 50
  • 7. What's cool in the new and updated OSGi specs Data Transfer Objects 7 of 50
  • 8. What's cool in the new and updated OSGi specs RFC 185 – Data Transfer Object Defines a DTO model for OSGi Serializable/Deserializable objects Use cases: REST, JMX, Web Console... To be adopted by other specs 8 of 50
  • 9. What's cool in the new and updated OSGi specs RFC 185 – Data Transfer Object Getting DTOs: adapter pattern public class BundleDTO extends org.osgi.dto.DTO { public long id; public long lastModified; public int state; public String symbolicName; public String version; } 9 of 50
  • 10. What's cool in the new and updated OSGi specs RFC 185 – Data Transfer Object DTOs for the OSGi framework FrameworkDTO BundleDTO ServiceReferenceDTO BundleStartLevelDTO, FrameworkStartLevel CapabilityDTO, RequirementDTO, Resource BundleWiringsDTO, etc 10 of 50
  • 11. What's cool in the new and updated OSGi specs OSGi/CDI integration 11 of 50
  • 12. What's cool in the new and updated OSGi specs RFC 193 - CDI Support Bridging OSGi and standard JavaEE dependency model ● Publishing CDI beans as OSGi services ● Injecting OSGi services in CDI beans CDI = Contexts and dependency injection 12 of 50
  • 13. What's cool in the new and updated OSGi specs RFC 193 - Examples ● Publishing CDI bean as OSGi service @Component public class MyComponent implements MyInterface { ... } ● Dependency Injection @Inject @Service private MyInterface serviceA; @Inject @Service(optional = true ) private MyInterface serviceB; 13 of 50
  • 14. What's cool in the new and updated OSGi specs Repository 1.1 14 of 50
  • 15. What's cool in the new and updated OSGi specs OSGi Repository today 15 of 50
  • 16. What's cool in the new and updated OSGi specs Example Repository namespaces 16 of 50
  • 17. What's cool in the new and updated OSGi specs RFC 187 - Repository 1.1 Existing repository powerful but: limited to queries in a single namespace New in RFC 187: Combine requirements spanning multiple namespaces: Repository repo = ... // Obtain from Service Registry Collection <Resource > res = repo.findProviders( R repo.getExpressionCombiner().and( a repo.newRequirementBuilder("osgi.wiring.package"). addDirective("filter","(osgi.wiring.package=foo.pkg1)"). buildExpression(), repo.newRequirementBuilder("osgi.identity"). addDirective("filter", "(license=http://opensource.org/licenses/Apache-2.0)"). buildExpression())); 17 of 50
  • 18. What's cool in the new and updated OSGi specs Declarative Services 18 of 50
  • 19. What's cool in the new and updated OSGi specs RFC 190 - Declarative Services Enhancements Support of service scopes Diagnostic API DTOs But most importantly... 19 of 50
  • 20. What's cool in the new and updated OSGi specs Use annotations for configuration... @interface MyConfig { boolean enabled() default true ; String [] topic() default {"topicA", "topicB"}; String userName(); int service_ranking() default 15; } 20 of 50
  • 21. What's cool in the new and updated OSGi specs ...and reference them in lifecycle methods @Component public class MyComponent { String userName; String [] topics; @Activate protected void activate(final MyConfig config) { f if ( config.enabled() ) { this .userName = config.userName(); this .topics = config.topic(); } } } 21 of 50
  • 22. What's cool in the new and updated OSGi specs ...or even simpler... @Component public class MyComponent { private MyConfig configuration; @Activate protected void activate(final MyConfig config) { f if ( config.enabled() ) { this .configuration = config; } } } 22 of 50
  • 23. What's cool in the new and updated OSGi specs Annotation Mapping Fields registered as component properties Name mapping (_ -> .) Type mapping for configurations 23 of 50
  • 24. What's cool in the new and updated OSGi specs Mapping @interface MyConfig { boolean enabled() default true ; String [] topic() default {"topicA", "topicB"}; String userName(); int service_ranking() default 15; } 24 of 50
  • 25. What's cool in the new and updated OSGi specs RFC 190 - Declarative Services Enhancements Annotation configuration support Support of service scopes Diagnostic API DTOs 25 of 50
  • 26. What's cool in the new and updated OSGi specs HTTP Service 26 of 50
  • 27. What's cool in the new and updated OSGi specs RFC 189 - Http Service Update Update to Servlet API 3+ Whiteboard support for Servlets, Servlet Filters Listeners, Resources and HttpContexts and DTOs 27 of 50
  • 28. What's cool in the new and updated OSGi specs Whiteboard Servlet Registration @Component(service = javax.servlet.Servlet .class , S c scope="PROTOTYPE", property ={ "osgi.http.whiteboard.servlet.pattern=/products/*", }) public class MyServlet extends HttpServlet { ... } 28 of 50
  • 29. What's cool in the new and updated OSGi specs Whiteboard Servlet Filter Registration @Component(service = javax.servlet.Filter .class , F c scope="PROTOTYPE", property ={ "osgi.http.whiteboard.filter.pattern=/products/*", }) public class MyFilter implements Filter { ... } 29 of 50
  • 30. What's cool in the new and updated OSGi specs Additional Support Most listener types are supported Register with their interface Error Pages and Resources Shared HttpContexts Target Http Service 30 of 50
  • 31. What's cool in the new and updated OSGi specs Cloud 31 of 50
  • 32. What's cool in the new and updated OSGi specs Current PaaS offerings... 32 of 50
  • 33. What's cool in the new and updated OSGi specs OSGi Cloud Ecosystems PaaS 33 of 50
  • 34. What's cool in the new and updated OSGi specs An OSGi cloud ecosystem... Many frameworks ○ hosting a variety of deployments Together providing The Application Not a bunch of replicas ○ rather a collection of different nodes ○ with different roles working together ○ some may be replicas Load varies over time ... and so does your cloud system ○ topology ○ configuration ○ number of nodes ○ depending on the demand 34 of 50
  • 35. What's cool in the new and updated OSGi specs To realize this you need... Information! ○ need to know what nodes are available ○ ability to react to changes Provisioning capability Remote invocation ○ inside your cloud system ○ to get nodes to communicate ○ either directly... ○ ... or as a means to set up communication channels 35 of 50
  • 36. What's cool in the new and updated OSGi specs RFC 183 - Cloud Ecosystems FrameworkNodeStatus service: information about each Cloud node accessible as a Remote Service throughout the ecosystem Information such as: Hostname/IP address Location (country etc) OSGi and Java version running A REST management URL Runtime metadata Available memory / disk space Load measurement ... you can add custom metadata too ... 36 of 50
  • 37. What's cool in the new and updated OSGi specs FrameworkNodeStatus service properties 37 of 50
  • 38. What's cool in the new and updated OSGi specs RFC 182 - REST API A cloud-friendly remote management API works great with FrameworkNodeStatus Example: addingService(ServiceReference <FrameworkNodeStatus > ref) { S F // A new Node became available String url = ref.getProperty("org.osgi.node.rest.url"); RestClient rc = new RestClient (new URI(url)); n // Provision the new node rc.installBundle(...); rc.startBundle(...); } 38 of 50
  • 39. What's cool in the new and updated OSGi specs Additional ideas in RFC 183 Special Remote Services config type ・ osgi.configtype.ecosystem ・ defines supported Remote Service data types ・ not visible outside of cloud system Ability to intercept remote service calls ・ can provide different service for each client ・ can do invocation counting (quotas, billing) Providing remote services meta-data ・ quota exceeded ・ payment needed ・ maintenance scheduled 39 of 50
  • 40. What's cool in the new and updated OSGi specs Current OSGi cloud work Provides a base line ○ to build fluid cloud systems ○ portability across clouds Where everything is dynamic ○ nodes can be repurposed ... and you deal with your cloud nodes through OSGi services 40 of 50
  • 41. What's cool in the new and updated OSGi specs Portable Java Contracts 41 of 50
  • 42. What's cool in the new and updated OSGi specs Semantic Versioning... ... is a versioning policy for exported packages. OSGi versions: <major>.<minor>.<micro>.<qualifier> Updating package versions: ● fix/patch (no change to API): update micro ● extend API (affects implementers, not clients): update minor ● API breakage: update major Note: not always used for bundle versions 42 of 50
  • 43. What's cool in the new and updated OSGi specs Semantic Versioning is great, but... - not all projects use it, e.g. APIs from JSRs - e.g. Servlet 3 is backward compatible with 2.5 - what's its javax.servlet package version? 2.6 ? or 3.0 ? - different projects made different choices 43 of 50
  • 44. What's cool in the new and updated OSGi specs RFC 180: Portable Java Contracts osgi.contract capability to the rescue ● client bundle requires capability with 'marketing' or 'spec' version ● and also imports the package without version osgi.contract provider binds the contract version to package versions Import -Package : javax.servlet, javax.servlet.http P Require -Capability : osgi.contract; C filter:="(&(osgi.contract=JavaServlet)(version=3.0))" Allows writing portable bundles that import non-semant versioned packages. 44 of 50
  • 45. What's cool in the new and updated OSGi specs Type and Package Annotations 45 of 50
  • 46. What's cool in the new and updated OSGi specs RFC 197 – OSGi Type and Package Annotations Annotations for documenting semantic versioning information Class retention annotations @Version @ProviderType @ConsumerType 46 of 50
  • 47. What's cool in the new and updated OSGi specs Other Enterprise Spec updates 47 of 50
  • 48. What's cool in the new and updated OSGi specs ▻ Blueprint 1.1 ・ Non-damped service references ・ Grace period enhancements ・ Many small fixes ▻ Remote Service Admin 1.1 ・ Remote Service registration modification ▻ Subsystems 1.1 ・ Provide Deployment Manifest separately ・ Many small enhancements 48 of 50
  • 49. What's cool in the new and updated OSGi specs When can I get it? RFCs available to everyone today: https://github.com/osgi/design (https://github.com/osgi/design) ◎ Most work aimed at Core/Enterprise R6 (2014) ◎ Some specs in Enterprise R7 (2015) 49 of 50
  • 50. What's cool in the new and updated OSGi specs Questions? 50 of 50