David Bosschaert [http://community.jboss.org/people/bosschaert] replied to the discussion
"Deployer ordering question (JBoss OSGi)" To view the discussion, visit: http://community.jboss.org/message/549421#549421 -------------------------------------------------------------- > Ales Justin wrote: > > > In the JBoss OSGi project I have > > http://github.com/jbosgi/jbosgi-framework/blob/master/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiStartLevelMetaDataDeployer.java > > a deployer that adds some metadata to the deployment unit. > I only see you reading from deployment unit, but not writing. protected void internalDeploy(DeploymentUnit unit) throws DeploymentException { StartLevelPlugin slp = bundleManager.getOptionalPlugin(StartLevelPlugin.class); if (slp == null) return; OSGiMetaData md = unit.getAttachment(OSGiMetaData.class); if (md instanceof AbstractOSGiMetaData) { AbstractOSGiMetaData amd = (AbstractOSGiMetaData)md; int bsl = slp.getInitialBundleStartLevel( md.getBundleSymbolicName(), Version.parseVersion(md.getBundleVersion())); if (bsl != StartLevelPlugin.INITIAL_BUNDLE_STARTLEVEL_UNSPECIFIED) { amd.setInitialStartLevel(bsl); } } } In the very last line I'm writing to the deployment metadata that is already in the deployment unit. > In the > http://github.com/jbosgi/jbosgi-framework/blob/master/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleState.java > OSGiBundleState I want to read that metadata out again after the bundle is > installed. Currently in the code it initialises that metadata at the > beginning of the start() method but that's really too late because you also > want to be able to read out the start level of bundles that are just > installed.> > > Is there a callback I can add to OSGiBundleState that gets called after my > > OSGiStartLevelMetaDataDeployer has run but still as part of the bundle > > install? > I don't understand what exactly do you mean / need. I need to access this OSGiMetaData in the OSGiBundleState after the bundle was installed but before someone calls start(). I tried overriding changeState() with reacting to the Bundle.INSTALLED change state but that's always called back before my deployer was called (too early). So I need a callback in the OSGiBundleState that calls me back at the right time so I can initialize the state based on what's in the OSGiMetaData. I couldn't find the right callback for that. Maybe we need to somehow get the OSGiStartLevelMetaDataDeployer to run a bit earlier as well to achieve this, I'm not sure... -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/549421#549421] Start a new discussion in JBoss Microcontainer at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
