[jboss-cvs] JBossAS SVN: r92953 - in projects/demos/microcontainer/trunk/igloo/src/main: resources/META-INF and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 28 10:00:03 EDT 2009


Author: alesj
Date: 2009-08-28 10:00:03 -0400 (Fri, 28 Aug 2009)
New Revision: 92953

Added:
   projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleResolveDeployer.java
Modified:
   projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleStartStopDeployer.java
   projects/demos/microcontainer/trunk/igloo/src/main/resources/META-INF/igloo-beans.xml
Log:
Add new resolve deployer.

Copied: projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleResolveDeployer.java (from rev 92952, projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleStartStopDeployer.java)
===================================================================
--- projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleResolveDeployer.java	                        (rev 0)
+++ projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleResolveDeployer.java	2009-08-28 14:00:03 UTC (rev 92953)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.demos.bootstrap.igloo.deployers;
+
+import java.util.Set;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.deployers.spi.DeploymentException;
+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.osgi.spi.metadata.OSGiMetaData;
+
+/**
+ * Simple bundle resolve deployer.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class BundleResolveDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
+{
+   static final ControllerState CLASSLOADER_STATE = new ControllerState(DeploymentStages.CLASSLOADER.getName());
+
+   public BundleResolveDeployer()
+   {
+      super(OSGiMetaData.class);
+      setStage(DeploymentStages.DESCRIBE);
+      setTopLevelOnly(true);
+   }
+
+   public void deploy(DeploymentUnit unit, OSGiMetaData deployment) throws DeploymentException
+   {
+      ControllerContext context = unit.getAttachment(ControllerContext.class);
+      if (context != null)
+      {
+         DependencyInfo info = context.getDependencyInfo();
+         Set<DependencyItem> items = info.getUnresolvedDependencies(CLASSLOADER_STATE);
+         if (items == null || items.isEmpty())
+            unit.setRequiredStage(DeploymentStages.CLASSLOADER);
+      }
+   }
+}
\ No newline at end of file

Modified: projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleStartStopDeployer.java
===================================================================
--- projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleStartStopDeployer.java	2009-08-28 12:49:20 UTC (rev 92952)
+++ projects/demos/microcontainer/trunk/igloo/src/main/java/org/jboss/demos/bootstrap/igloo/deployers/BundleStartStopDeployer.java	2009-08-28 14:00:03 UTC (rev 92953)
@@ -38,7 +38,8 @@
    public BundleStartStopDeployer()
    {
       super(OSGiBundleState.class);
-      setStage(DeploymentStages.DESCRIBE);
+      setStage(DeploymentStages.CLASSLOADER);
+      setTopLevelOnly(true);
    }
 
    public void deploy(DeploymentUnit unit, OSGiBundleState deployment) throws DeploymentException

Modified: projects/demos/microcontainer/trunk/igloo/src/main/resources/META-INF/igloo-beans.xml
===================================================================
--- projects/demos/microcontainer/trunk/igloo/src/main/resources/META-INF/igloo-beans.xml	2009-08-28 12:49:20 UTC (rev 92952)
+++ projects/demos/microcontainer/trunk/igloo/src/main/resources/META-INF/igloo-beans.xml	2009-08-28 14:00:03 UTC (rev 92953)
@@ -58,6 +58,7 @@
   <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.facade.classloading.OSGiBundleClassLoadingDeployer"/>
   <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
 
-  <bean name="OSGiBundleStartStopDeployer" class="org.jboss.demos.bootstrap.igloo.deployers.BundleStartStopDeployer" />  
+  <bean name="OSGiBundleResolveDeployer" class="org.jboss.demos.bootstrap.igloo.deployers.BundleResolveDeployer" />  
+  <bean name="OSGiBundleStartStopDeployer" class="org.jboss.demos.bootstrap.igloo.deployers.BundleStartStopDeployer" />
 
 </deployment>




More information about the jboss-cvs-commits mailing list