[jboss-cvs] JBossAS SVN: r59366 - in projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers: plugins/attachments plugins/deployer spi/attachments

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 5 03:28:15 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-05 03:28:11 -0500 (Fri, 05 Jan 2007)
New Revision: 59366

Modified:
   projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java
   projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java
   projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/spi/attachments/Attachments.java
Log:
Add a hasAttachments method to determine if any attachments exist.

Modified: projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java
===================================================================
--- projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java	2007-01-05 04:56:24 UTC (rev 59365)
+++ projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/attachments/AttachmentsImpl.java	2007-01-05 08:28:11 UTC (rev 59366)
@@ -82,4 +82,9 @@
    {
       attachments.clear();
    }
+
+   public boolean hasAttachments()
+   {
+      return attachments.isEmpty() == false;
+   }
 }

Modified: projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java
===================================================================
--- projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java	2007-01-05 04:56:24 UTC (rev 59365)
+++ projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java	2007-01-05 08:28:11 UTC (rev 59366)
@@ -285,6 +285,27 @@
       return deploymentContext.getTransientManagedObjects();
    }
 
+   public boolean hasAttachments()
+   {
+      boolean hasAttachments = false;
+      DeploymentContext parent = deploymentContext.getParent();
+      if (deploymentContext.isComponent() == false)
+         parent = null;
+      if (parent != null)
+         hasAttachments = parent.getTransientAttachments().hasAttachments();
+      hasAttachments |= deploymentContext.getTransientAttachments().hasAttachments();
+      if( hasAttachments == false )
+      {
+         if (parent != null)
+            hasAttachments |= parent.getTransientManagedObjects().hasAttachments();
+         hasAttachments |= deploymentContext.getTransientManagedObjects().hasAttachments();
+         if (parent != null)
+            hasAttachments |= parent.getPredeterminedManagedObjects().hasAttachments();
+         hasAttachments |= deploymentContext.getPredeterminedManagedObjects().hasAttachments();
+      }
+      return hasAttachments;
+   }
+
    @SuppressWarnings("unchecked")
    // TODO optimize
    public <T> Set<? extends T> getAllMetaData(Class<T> type)

Modified: projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/spi/attachments/Attachments.java
===================================================================
--- projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/spi/attachments/Attachments.java	2007-01-05 04:56:24 UTC (rev 59365)
+++ projects/microcontainer/branches/2_0/deployers/src/main/org/jboss/deployers/spi/attachments/Attachments.java	2007-01-05 08:28:11 UTC (rev 59366)
@@ -170,4 +170,10 @@
     * @throws UnsupportedOperationException when not supported by the implementation
     */
    void clear();
+
+   /**
+    * Are there any attachments
+    * @return true if there are any attachments, false otherwise.
+    */
+   public boolean hasAttachments();
 }




More information about the jboss-cvs-commits mailing list