Add support CDI in plain OSGi bundles (GLASSFISH-19215)

[GLASSFISH-19325] moving the logics of publishing beans into OSGiServiceExtension class Created: 13/Nov/12  Updated: 14/Nov/12

Status: Open
Project: glassfish
Component/s: OSGi-JavaEE
Affects Version/s: future release
Fix Version/s: None

Type: Sub-task Priority: Critical
Reporter: TangYong Assignee: Sanjeeb Sahoo
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Needing to move the logics of publishing beans into OSGiServiceExtension class in order to make @Publish to work in hybrid javaee bundle.

Comment by TangYong [ 14/Nov/12 ]

Currently, this moving has been finished, and triggering publish services has been put into AfterDeploymentValidation Observer method as following:

void afterDeploymentValidation(@Observes AfterDeploymentValidation adv)

{ //Publish @Publish Classes into OSGi Registry Instance<Object> instance = this.manager.instance(); publishOSGiService(instance); }

And, beforeBeanDiscovery method adds the second parameter as following,

void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bdd, BeanManager manager){
debug("beforeBeanDiscovery" + bdd);
bdd.addQualifier(OSGiService.class); //XXX:needed?

if (manager instanceof WeldManager)

{ this.manager = (WeldManager)manager; }


In the future, once CDI Specification adds a portable method called "Instance<Object> instance()", the strong type cast(WeldManager) will be deleted and make a improvement. Now, the above is enough.

Generated at Mon Jan 16 14:14:55 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.