[jboss-cvs] JBossAS SVN: r85032 - projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 2 07:23:56 EST 2009


Author: alesj
Date: 2009-03-02 07:23:55 -0500 (Mon, 02 Mar 2009)
New Revision: 85032

Modified:
   projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDependencyDeployer.java
   projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
Log:
OSGiDeployer should only care about creating/installing the bundle.
(and adding listener, since that's where the access to its creating BundleContext is)
But all other attachments wrt Bundle should be moved to other deployers.

Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDependencyDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDependencyDeployer.java	2009-03-02 12:21:21 UTC (rev 85031)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleClassLoaderDependencyDeployer.java	2009-03-02 12:23:55 UTC (rev 85032)
@@ -27,6 +27,7 @@
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.structure.spi.ClassLoaderFactory;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
 import org.jboss.osgi.deployer.helpers.BundleClassLoader;
 import org.jboss.osgi.deployer.helpers.ResolvedBundleDependencyItem;
 import org.osgi.framework.Bundle;
@@ -38,6 +39,9 @@
  */
 public class BundleClassLoaderDependencyDeployer extends AbstractSimpleRealDeployer<Bundle>
 {
+   /** Deployment filter */
+   private DeploymentUnitFilter filter = new BundleDeploymentUnitFilter();
+
    public BundleClassLoaderDependencyDeployer()
    {
       super(Bundle.class);
@@ -54,6 +58,10 @@
       // create dependency items
       //DependencyItem resolvedBundleDI = createResolvedBudleDependencyItem(bundle);
       //unit.addIDependOn(resolvedBundleDI);
+
+      // skip annotations scanning, if filter is set
+      if (filter != null)
+         unit.addAttachment(DeploymentUnitFilter.class, filter);
    }
 
    /**
@@ -87,4 +95,14 @@
    {
       return new ResolvedBundleDependencyItem(bundle);
    }
+
+   /**
+    * Set deployment filter.
+    *
+    * @param filter the deployment filter
+    */
+   public void setFilter(DeploymentUnitFilter filter)
+   {
+      this.filter = filter;
+   }
 }
\ No newline at end of file

Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java	2009-03-02 12:21:21 UTC (rev 85031)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java	2009-03-02 12:23:55 UTC (rev 85032)
@@ -30,12 +30,9 @@
 import org.jboss.deployers.spi.deployer.DeploymentStages;
 import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.DeploymentUnitFilter;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
 import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
 
 /**
  * This is the OSGi Deployer
@@ -70,14 +67,13 @@
    {
       if (bundleContext == null)
          throw new IllegalArgumentException("No system bundle context.");
-      
-      bundleContext.addBundleListener(new DeployerBundleListener());
+
+      // TODO - add VDF bundle listener
    }
 
    public void stop()
    {
-      if (bundleContext == null)
-         return;
+      // TODO - remove VDF bundle listener
    }
 
    public void deploy(DeploymentUnit unit, OSGiMetaData metadata) throws DeploymentException
@@ -91,10 +87,6 @@
          if (skipBundles != null && skipBundles.contains(bundleUri) == false)
          {
             Bundle bundle = bundleContext.installBundle(bundleUri.toString());
-            
-            // Attach the DeploymentUnitFilter that allows Deployers to ignore this Deployment
-            unit.addAttachment(DeploymentUnitFilter.class, new BundleDeploymentUnitFilter());
-            
             unit.addAttachment(Bundle.class, bundle);
             
             log.info("Installed: " + bundle.getSymbolicName() + ",state=" + bundle.getState());
@@ -123,14 +115,4 @@
          }
       }
    }
-   
-   class DeployerBundleListener implements BundleListener
-   {
-      public void bundleChanged(BundleEvent event)
-      {
-         //Bundle bundle = event.getBundle();
-         //int type = event.getType();
-         //System.out.println("bundleChanged: " + event + ",type=" + type + ",state=" + bundle.getState());
-      }
-   }
 }




More information about the jboss-cvs-commits mailing list