[jboss-dev-forums] [JBoss OSGi Development] - Re: Autostart bundles when deployed in JBossAS

thomas.diesler@jboss.com do-not-reply at jboss.com
Fri Sep 4 12:48:27 EDT 2009


Here is an update to the issue

I removed the LifecycleCallbackItem and its associated Thread

Instead I use a wrapper around the Deployers that are associated with the MainDeployer

http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/deployers/bundle/OSGiDeployersWrapper.java

This still relies on implementation detail and I'd like to replace the wrapper with some kind of listener that I can associate with the MainDeployer.


  |    public OSGiDeployersWrapper(MainDeployer mainDeployer, OSGiBundleManager bundleManager)
  |    {
  |       if (bundleManager == null)
  |          throw new IllegalArgumentException("Null bundleManager");
  |       if (mainDeployer instanceof MainDeployerImpl == false)
  |          throw new IllegalStateException("Cannot instrument: " + mainDeployer);
  | 
  |       this.mainDeployer = mainDeployer;
  |       this.bundleManager = bundleManager;
  | 
  |       // Swap the deployers implementation 
  |       MainDeployerImpl mainDeployerImpl = (MainDeployerImpl)mainDeployer;
  |       this.deployers = mainDeployerImpl.getDeployers();
  |       mainDeployerImpl.setDeployers(this);
  |    }
  | 
  |    public void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
  |    {
  |       // Delegate to the original deployers
  |       deployers.process(deploy, undeploy);
  | 
  |       // OSGi bundles resolve phase 
  |       afterDeployersProcess(deploy, undeploy);
  |    }
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4253629#4253629

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4253629



More information about the jboss-dev-forums mailing list