cdi and osgi so happy together! - r auge
TRANSCRIPT
![Page 2: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/2.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/3.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/4.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/5.jpg)
CDI Container
![Page 6: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/6.jpg)
CDI Container holds Managed Beans define graphs instances
![Page 7: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/7.jpg)
Managed Beans have a Scope
![Page 8: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/8.jpg)
Scopes define Lifecycle of managed beans
![Page 9: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/9.jpg)
Lifecycle follow edges of business logic resulting in Contexts which hold contextual instances
![Page 10: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/10.jpg)
Scope’s lifecycle is guided by business rules, may include aspects like identity
![Page 11: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/11.jpg)
Interactions defined by which scopes are Active as well as business rules
![Page 12: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/12.jpg)
Injection across scopes requires visibility
![Page 13: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/13.jpg)
Services are available to traditional scopes via synthetic reference bean
![Page 14: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/14.jpg)
@ApplicationScoped beans can provide services
![Page 15: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/15.jpg)
Configuration available for direct injection, to configure references and published services
![Page 16: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/16.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/17.jpg)
Pseudo @ComponentScoped encapsulates OSGi’s business rules
![Page 18: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/18.jpg)
@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](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/19.jpg)
Controlled visibility allows OSGi’s integration to fully support Dynamic Component Lifecycle
![Page 20: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/20.jpg)
@Reference to a service provided via synthetic bean scoped to the component context
![Page 21: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/21.jpg)
@Component can provide services
![Page 22: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/22.jpg)
Configuration available for direct injection, to configure references and published services
![Page 23: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/23.jpg)
That’s a lot of detail, but...
What does it look like?
![Page 24: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/24.jpg)
@Reference a service in a normal bean
![Page 25: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/25.jpg)
Provide a @Service from regular bean
![Page 26: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/26.jpg)
@Configuration @Property @Service
![Page 27: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/27.jpg)
Producer method, @SessionScoped instance, prototype service
![Page 28: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/28.jpg)
Optional @Reference
![Page 29: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/29.jpg)
@Component with @Reference & multi-configuration interests
![Page 30: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/30.jpg)
Factory component providing a service
![Page 31: CDI and OSGi so happy together! - R Auge](https://reader033.vdocument.in/reader033/viewer/2022051521/5a64a88b7f8b9a88568b4ff1/html5/thumbnails/31.jpg)