cdi and osgi so happy together! - r auge

31
CDI and OSGi So happy together! Raymond Augé [email protected]

Upload: mfrancis

Post on 21-Jan-2018

49 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: CDI and OSGi  so happy together! - R Auge

CDI and OSGiSo happy together!

Raymond Augé[email protected]

Page 2: CDI and OSGi  so happy together! - R Auge

Disclaimer

Everything in this presentation is subject to change at any time as it consists of in-progress specification work.

Page 3: CDI and OSGi  so happy together! - R Auge

CDI - Key GoalsDevelop a simple and intuitive model for existing CDI developers

Simplify OSGi challenges for new adopters

Take advantage of CDI’s SPI as much as possible to ensure compatibility

Enable the simplest migration path for existing applications

Page 4: CDI and OSGi  so happy together! - R Auge

OSGi - Key GoalsProvide services (of all service scopes)

Optional, greedy/reluctant, static/dynamic, unary/n-ary, ordered service dependencies

Integration with Configuration Admin (& factory configurations)

Lazy dependency management (no damping!)

Page 5: CDI and OSGi  so happy together! - R Auge

CDI Container

Page 6: CDI and OSGi  so happy together! - R Auge

CDI Container holds Managed Beans define graphs instances

Page 7: CDI and OSGi  so happy together! - R Auge

Managed Beans have a Scope

Page 8: CDI and OSGi  so happy together! - R Auge

Scopes define Lifecycle of managed beans

Page 9: CDI and OSGi  so happy together! - R Auge

Lifecycle follow edges of business logic resulting in Contexts which hold contextual instances

Page 10: CDI and OSGi  so happy together! - R Auge

Scope’s lifecycle is guided by business rules, may include aspects like identity

Page 11: CDI and OSGi  so happy together! - R Auge

Interactions defined by which scopes are Active as well as business rules

Page 12: CDI and OSGi  so happy together! - R Auge

Injection across scopes requires visibility

Page 13: CDI and OSGi  so happy together! - R Auge

Services are available to traditional scopes via synthetic reference bean

Page 14: CDI and OSGi  so happy together! - R Auge

@ApplicationScoped beans can provide services

Page 15: CDI and OSGi  so happy together! - R Auge

Configuration available for direct injection, to configure references and published services

Page 16: CDI and OSGi  so happy together! - R Auge

Dynamism of dependencies affect this whole region of the container as a single component: Application Component

Page 17: CDI and OSGi  so happy together! - R Auge

Pseudo @ComponentScoped encapsulates OSGi’s business rules

Page 18: CDI and OSGi  so happy together! - R Auge

@ComponentScoped beans form a graph of contextual instances within a context rooted in the @Component bean, identified by name

Page 19: CDI and OSGi  so happy together! - R Auge

Controlled visibility allows OSGi’s integration to fully support Dynamic Component Lifecycle

Page 20: CDI and OSGi  so happy together! - R Auge

@Reference to a service provided via synthetic bean scoped to the component context

Page 21: CDI and OSGi  so happy together! - R Auge

@Component can provide services

Page 22: CDI and OSGi  so happy together! - R Auge

Configuration available for direct injection, to configure references and published services

Page 23: CDI and OSGi  so happy together! - R Auge

That’s a lot of detail, but...

What does it look like?

Page 24: CDI and OSGi  so happy together! - R Auge

@Reference a service in a normal bean

Page 25: CDI and OSGi  so happy together! - R Auge

Provide a @Service from regular bean

Page 26: CDI and OSGi  so happy together! - R Auge

@Configuration @Property @Service

Page 27: CDI and OSGi  so happy together! - R Auge

Producer method, @SessionScoped instance, prototype service

Page 28: CDI and OSGi  so happy together! - R Auge

Optional @Reference

Page 29: CDI and OSGi  so happy together! - R Auge

@Component with @Reference & multi-configuration interests

Page 30: CDI and OSGi  so happy together! - R Auge

Factory component providing a service

Page 31: CDI and OSGi  so happy together! - R Auge