[jboss-cvs] JBossAS SVN: r59367 - in projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins: attachments deployer

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


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

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

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

Modified: projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java
===================================================================
--- projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java	2007-01-05 08:28:11 UTC (rev 59366)
+++ projects/microcontainer/trunk/deployers/src/main/org/jboss/deployers/plugins/deployer/AbstractDeploymentUnit.java	2007-01-05 08:30:11 UTC (rev 59367)
@@ -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)




More information about the jboss-cvs-commits mailing list