[jboss-cvs] JBossAS SVN: r110930 - projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 16 11:41:28 EDT 2011


Author: alesj
Date: 2011-03-16 11:41:28 -0400 (Wed, 16 Mar 2011)
New Revision: 110930

Modified:
   projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java
   projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java
Log:
Push generic lookup code up to AbstractDeployer.

Modified: projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java	2011-03-16 15:30:44 UTC (rev 110929)
+++ projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java	2011-03-16 15:41:28 UTC (rev 110930)
@@ -21,9 +21,7 @@
  */
 package org.jboss.deployers.spi.deployer.helpers;
 
-import java.util.HashSet;
-import java.util.Set;
-
+import org.jboss.deployers.spi.attachments.LocalAttachments;
 import org.jboss.deployers.spi.deployer.Deployer;
 import org.jboss.deployers.spi.deployer.DeploymentStage;
 import org.jboss.deployers.spi.deployer.DeploymentStages;
@@ -31,6 +29,9 @@
 import org.jboss.deployers.structure.spi.DeploymentUnitExt;
 import org.jboss.logging.Logger;
 
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * AbstractDeployer.
  * 
@@ -79,6 +80,9 @@
    /** Whether to process parents first */
    private boolean parentFirst = true;
    
+   /** The force hierarchy lookup flag */
+   private boolean forceHierarchyLookup;
+
    public int getRelativeOrder()
    {
       return relativeOrder;
@@ -448,6 +452,16 @@
       this.parentFirst = parentFirst;
    }
 
+   /**
+    * Set hierarchy flag.
+    *
+    * @param forceHierarchyLookup the flag
+    */
+   public void setForceHierarchyLookup(boolean forceHierarchyLookup)
+   {
+      this.forceHierarchyLookup = forceHierarchyLookup;
+   }
+
    public void undeploy(DeploymentUnit unit)
    {
       // Nothing
@@ -467,4 +481,21 @@
          ext.changeRelativeOrder(relativeOrder);
       }
    }
+
+   /**
+    * Get attachment.
+    *
+    * @param unit the current deployment unit
+    * @param type the attachment type
+    * @return attachment or null
+    */
+   protected <T> T getAttachment(DeploymentUnit unit, Class<T> type)
+   {
+      if (forceHierarchyLookup == false && isComponentsOnly() && (unit instanceof LocalAttachments))
+      {
+         LocalAttachments la = (LocalAttachments) unit;
+         return la.getLocalAttachment(type);
+      }
+      return unit.getAttachment(type);
+   }
 }

Modified: projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java	2011-03-16 15:30:44 UTC (rev 110929)
+++ projects/jboss-deployers/trunk/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java	2011-03-16 15:41:28 UTC (rev 110930)
@@ -22,7 +22,6 @@
 package org.jboss.deployers.spi.deployer.helpers;
 
 import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.attachments.LocalAttachments;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
 
 /**
@@ -35,9 +34,6 @@
  */
 public abstract class AbstractSimpleRealDeployer<T> extends AbstractRealDeployer
 {
-   /** The force hierarchy lookup flag */
-   private boolean forceHierarchyLookup;
-
    /**
     * Create a new AbstractSimpleRealDeployer
     *  
@@ -60,32 +56,16 @@
       return (Class<? extends T>) input;
    }
 
-   /**
-    * Get attachment.
-    *
-    * @param unit the current deployment unit
-    * @return attachment or null
-    */
-   protected T getAttachment(DeploymentUnit unit)
-   {
-      if (forceHierarchyLookup == false && isComponentsOnly() && (unit instanceof LocalAttachments))
-      {
-         LocalAttachments la = (LocalAttachments) unit;
-         return la.getLocalAttachment(getInput());
-      }
-      return unit.getAttachment(getInput());
-   }
-
    public void internalDeploy(DeploymentUnit unit) throws DeploymentException
    {
-      T deployment = getAttachment(unit);
+      T deployment = getAttachment(unit, getInput());
       if (deployment != null)
          deploy(unit, deployment);
    }
 
    public void internalUndeploy(DeploymentUnit unit)
    {
-      T deployment = getAttachment(unit);
+      T deployment = getAttachment(unit, getInput());
       if (deployment != null)
          undeploy(unit, deployment);
    }
@@ -96,14 +76,4 @@
    {
       // Nothing
    }
-
-   /**
-    * Set hierarchy flag.
-    *
-    * @param forceHierarchyLookup the flag
-    */
-   public void setForceHierarchyLookup(boolean forceHierarchyLookup)
-   {
-      this.forceHierarchyLookup = forceHierarchyLookup;
-   }
 }



More information about the jboss-cvs-commits mailing list