[jboss-cvs] JBossAS SVN: r110969 - in projects/jboss-deployers/branches/Branch_2_2: build/src/assembly and 16 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 18 09:22:11 EDT 2011
Author: alesj
Date: 2011-03-18 09:22:11 -0400 (Fri, 18 Mar 2011)
New Revision: 110969
Added:
projects/jboss-deployers/branches/Branch_2_2/deployers-core-spi/src/main/java/org/jboss/deployers/spi/attachments/LocalAttachments.java
projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/test/AbstractLocalAttachmentsUnitTestCase.java
Modified:
projects/jboss-deployers/branches/Branch_2_2/
projects/jboss-deployers/branches/Branch_2_2/build/src/assembly/
projects/jboss-deployers/branches/Branch_2_2/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_2/deployers-impl/src/test/java/org/jboss/test/deployers/managed/test/AbstractManagedObjectUnitTest.java
projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java
projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java
projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java
projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/StructureProcessor.java
projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java
projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/VFS2BaseBridgeDeploymentUnitFilter.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/HostNameCreator.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structureprocessor/test/VFSStructureProcessorUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningWithMetaDataUnitTestCase.xml
Log:
Port fixes from trunk
Property changes on: projects/jboss-deployers/branches/Branch_2_2
___________________________________________________________________
Added: svn:mergeinfo
+ /projects/jboss-deployers/trunk:110263,110265-110968
Property changes on: projects/jboss-deployers/branches/Branch_2_2/build/src/assembly
___________________________________________________________________
Deleted: svn:mergeinfo
-
Copied: projects/jboss-deployers/branches/Branch_2_2/deployers-core-spi/src/main/java/org/jboss/deployers/spi/attachments/LocalAttachments.java (from rev 110968, projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/attachments/LocalAttachments.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-core-spi/src/main/java/org/jboss/deployers/spi/attachments/LocalAttachments.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-core-spi/src/main/java/org/jboss/deployers/spi/attachments/LocalAttachments.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -0,0 +1,107 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.deployers.spi.attachments;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * Local attachments
+ *
+ * Represents a set of local attachments
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface LocalAttachments extends Serializable
+{
+ /**
+ * Get all the local attachments
+ *
+ * @return the unmodifiable attachments
+ */
+ Map<String, Object> getLocalAttachments();
+
+ /**
+ * Get local attachment
+ *
+ * @param name the name of the attachment
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name
+ */
+ Object getLocalAttachment(String name);
+
+ /**
+ * Get local attachment
+ *
+ * @param <T> the expected type
+ * @param name the name of the attachment
+ * @param expectedType the expected type
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or expectedType
+ */
+ <T> T getLocalAttachment(String name, Class<T> expectedType);
+
+ /**
+ * Get local attachment
+ *
+ * @param <T> the expected type
+ * @param type the type
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ <T> T getLocalAttachment(Class<T> type);
+
+ /**
+ * Is the local attachment present
+ *
+ * @param name the name of the attachment
+ * @return true when the attachment is present
+ * @throws IllegalArgumentException for a null name
+ */
+ boolean isLocalAttachmentPresent(String name);
+
+ /**
+ * Is the local attachment present
+ *
+ * @param name the name of the attachment
+ * @param expectedType the expected type
+ * @return true when the attachment is present
+ * @throws IllegalArgumentException for a null name or expectedType
+ */
+ boolean isLocalAttachmentPresent(String name, Class<?> expectedType);
+
+ /**
+ * Is the local attachment present
+ *
+ * @param type the type
+ * @return true when the attachment is present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ boolean isLocalAttachmentPresent(Class<?> type);
+
+ /**
+ * Are there any local attachments
+ *
+ * @return true if there are any attachments, false otherwise.
+ */
+ boolean hasLocalAttachments();
+}
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-impl/src/test/java/org/jboss/test/deployers/classloading/test/ModuleRemoveUnitTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-impl/src/test/java/org/jboss/test/deployers/managed/test/AbstractManagedObjectUnitTest.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java 2011-03-18 12:00:43 UTC (rev 110968)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractDeployer.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -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/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java 2011-03-18 12:00:43 UTC (rev 110968)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractSimpleRealDeployer.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -29,6 +29,7 @@
*
* @param <T> the input type
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public abstract class AbstractSimpleRealDeployer<T> extends AbstractRealDeployer
@@ -57,14 +58,14 @@
public void internalDeploy(DeploymentUnit unit) throws DeploymentException
{
- T deployment = unit.getAttachment(getInput());
+ T deployment = getAttachment(unit, getInput());
if (deployment != null)
deploy(unit, deployment);
}
public void internalUndeploy(DeploymentUnit unit)
{
- T deployment = unit.getAttachment(getInput());
+ T deployment = getAttachment(unit, getInput());
if (deployment != null)
undeploy(unit, deployment);
}
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnitFilter.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/StructureProcessor.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java 2011-03-18 12:00:43 UTC (rev 110968)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -21,6 +21,25 @@
*/
package org.jboss.deployers.structure.spi.helpers;
+import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.DependencyItem;
+import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.LocalAttachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.DeploymentContextExt;
+import org.jboss.deployers.structure.spi.DeploymentResourceLoader;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.DeploymentUnitExt;
+import org.jboss.deployers.structure.spi.DeploymentUnitVisitor;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.MutableMetaData;
+import org.jboss.metadata.spi.scope.ScopeKey;
+
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -32,18 +51,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.dependency.spi.DependencyInfo;
-import org.jboss.dependency.spi.DependencyItem;
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStage;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments;
-import org.jboss.deployers.structure.spi.*;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.MutableMetaData;
-import org.jboss.metadata.spi.scope.ScopeKey;
-
/**
* AbstractDeploymentUnit.<p>
*
@@ -55,7 +62,7 @@
* @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
-public class AbstractDeploymentUnit extends AbstractMutableAttachments implements DeploymentUnit, DeploymentUnitExt
+public class AbstractDeploymentUnit extends AbstractMutableAttachments implements DeploymentUnit, DeploymentUnitExt, LocalAttachments
{
/** The serialVersionUID */
private static final long serialVersionUID = 1513962148798298768L;
@@ -354,9 +361,14 @@
public Object getAttachment(String name)
{
+ return getAttachmentInternal(name, getDeploymentContext().isComponent());
+ }
+
+ private Object getAttachmentInternal(String name, boolean checkParent)
+ {
DeploymentContext deploymentContext = getDeploymentContext();
DeploymentContext parent = deploymentContext.getParent();
- if (deploymentContext.isComponent() == false)
+ if (checkParent == false)
parent = null;
Object result = deploymentContext.getPredeterminedManagedObjects().getAttachment(name);
if (result != null)
@@ -408,9 +420,14 @@
public Map<String, Object> getAttachments()
{
+ return getAttachmentsInternal(getDeploymentContext().isComponent());
+ }
+
+ private Map<String, Object> getAttachmentsInternal(boolean checkParent)
+ {
DeploymentContext deploymentContext = getDeploymentContext();
DeploymentContext parent = deploymentContext.getParent();
- if (deploymentContext.isComponent() == false)
+ if (checkParent == false)
parent = null;
HashMap<String, Object> result = new HashMap<String, Object>();
if (parent != null)
@@ -429,6 +446,11 @@
public boolean hasAttachments()
{
+ return hasAttachmentsInternal(getDeploymentContext().isComponent());
+ }
+
+ private boolean hasAttachmentsInternal(boolean checkParent)
+ {
DeploymentContext deploymentContext = getDeploymentContext();
if (deploymentContext.getTransientAttachments().hasAttachments())
return true;
@@ -436,17 +458,77 @@
return true;
else if (deploymentContext.getPredeterminedManagedObjects().hasAttachments())
return true;
-
- if (deploymentContext.isComponent())
- return deploymentContext.getParent().getDeploymentUnit().hasAttachments();
- return false;
+
+ return checkParent && deploymentContext.getParent().getDeploymentUnit().hasAttachments();
}
public boolean isAttachmentPresent(String name)
{
return getAttachment(name) != null;
}
-
+
+ public Map<String, Object> getLocalAttachments()
+ {
+ return getAttachmentsInternal(false);
+ }
+
+ public Object getLocalAttachment(String name)
+ {
+ return getAttachmentInternal(name, false);
+ }
+
+ public <T> T getLocalAttachment(String name, Class<T> expectedType)
+ {
+ if (expectedType == null)
+ throw new IllegalArgumentException("Null expectedType");
+ Object result = getLocalAttachment(name);
+ if (result == null)
+ return null;
+ return expectedType.cast(result);
+ }
+
+ public <T> T getLocalAttachment(Class<T> type)
+ {
+ if (type == null)
+ throw new IllegalArgumentException("Null type");
+ return getLocalAttachment(type.getName(), type);
+ }
+
+ public boolean isLocalAttachmentPresent(String name)
+ {
+ return getLocalAttachment(name) != null;
+ }
+
+ public boolean isLocalAttachmentPresent(String name, Class<?> expectedType)
+ {
+ if (expectedType == null)
+ throw new IllegalArgumentException("Null expectedType");
+ Object result = getLocalAttachment(name);
+ if (result == null)
+ return false;
+ try
+ {
+ expectedType.cast(result);
+ }
+ catch (ClassCastException e)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean isLocalAttachmentPresent(Class<?> type)
+ {
+ if (type == null)
+ throw new IllegalArgumentException("Null type");
+ return isLocalAttachmentPresent(type.getName(), type);
+ }
+
+ public boolean hasLocalAttachments()
+ {
+ return hasAttachmentsInternal(false);
+ }
+
public ClassLoader getResourceClassLoader()
{
return getDeploymentContext().getResourceClassLoader();
Modified: projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java 2011-03-18 12:00:43 UTC (rev 110968)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/StructureAttachmentsTestSuite.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -24,7 +24,6 @@
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
-
import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentContextPredeterminedManagedObjectsUnitTestCase;
import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentContextTransientAttachmentsUnitTestCase;
import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentContextTransientManagedObjectsUnitTestCase;
@@ -33,11 +32,13 @@
import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitPredeterminedManagedObjectsUnitTestCase;
import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitTransientAttachmentsUnitTestCase;
import org.jboss.test.deployers.structure.attachments.test.AbstractDeploymentUnitTransientManagedObjectsUnitTestCase;
+import org.jboss.test.deployers.structure.attachments.test.AbstractLocalAttachmentsUnitTestCase;
/**
* StructureAttachmentsTestSuite.
*
* @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class StructureAttachmentsTestSuite extends TestSuite
@@ -59,6 +60,7 @@
suite.addTest(AbstractDeploymentUnitTransientAttachmentsUnitTestCase.suite());
suite.addTest(AbstractDeploymentUnitAttachmentsUnitTestCase.suite());
suite.addTest(AbstractDeploymentUnitAttachmentHierarchyUnitTestCase.suite());
+ suite.addTest(AbstractLocalAttachmentsUnitTestCase.suite());
return suite;
}
Copied: projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/test/AbstractLocalAttachmentsUnitTestCase.java (from rev 110968, projects/jboss-deployers/trunk/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/test/AbstractLocalAttachmentsUnitTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/test/AbstractLocalAttachmentsUnitTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-structure-spi/src/test/java/org/jboss/test/deployers/structure/attachments/test/AbstractLocalAttachmentsUnitTestCase.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -0,0 +1,106 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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.test.deployers.structure.attachments.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.jboss.deployers.spi.attachments.Attachments;
+import org.jboss.deployers.spi.attachments.LocalAttachments;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
+import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit;
+import org.jboss.test.deployers.attachments.test.AttachmentsTest;
+import org.jboss.test.deployers.attachments.test.ExpectedAttachments;
+
+import java.util.Date;
+
+/**
+ * AbstractLocalAttachmentsUnitTestCase.
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public class AbstractLocalAttachmentsUnitTestCase extends AttachmentsTest
+{
+ public static Test suite()
+ {
+ return new TestSuite(AbstractLocalAttachmentsUnitTestCase.class);
+ }
+
+ private DeploymentUnit unit;
+
+ public AbstractLocalAttachmentsUnitTestCase(String name)
+ {
+ super(name);
+ AbstractDeploymentContext context = new AbstractDeploymentContext("attachments", "");
+ unit = new AbstractDeploymentUnit(context);
+ context.setDeploymentUnit(unit);
+ }
+
+ public void testLocal() throws Exception
+ {
+ DeploymentUnit component = unit.addComponent("component");
+
+ Date date1 = new Date();
+ Date date2 = new Date();
+ Integer i1 = 1;
+
+ unit.addAttachment(Date.class, date1);
+ unit.addAttachment("date1", date1, Date.class);
+ component.addAttachment(Date.class, date2);
+ component.addAttachment("date2", date2, Date.class);
+ unit.addAttachment(Integer.class, i1);
+
+ ExpectedAttachments ea = new ExpectedAttachments();
+ ea.add("date2", date2);
+ ea.add(Date.class.getName(), date2);
+
+ assertEquals(i1, unit.getAttachment(Integer.class));
+ assertEquals(i1, component.getAttachment(Integer.class));
+
+ LocalAttachments la = assertInstanceOf(component, LocalAttachments.class);
+ assertEquals(date2, la.getLocalAttachment(Date.class));
+ assertEquals(date2, la.getLocalAttachment("date2"));
+ assertEquals(date2, la.getLocalAttachment("date2", Date.class));
+ assertTrue(la.isLocalAttachmentPresent(Date.class));
+ assertTrue(la.isLocalAttachmentPresent("date2"));
+ assertTrue(la.isLocalAttachmentPresent("date2", Date.class));
+ assertTrue(la.hasLocalAttachments());
+ assertEquals(ea.expected, la.getLocalAttachments());
+ }
+
+ @Override
+ public void testSerialization() throws Exception
+ {
+ // ignore
+ }
+
+ protected Attachments getAttachments()
+ {
+ return unit;
+ }
+
+ protected MutableAttachments getMutable()
+ {
+ return unit;
+ }
+}
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/HostNameCreator.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structureprocessor/test/VFSStructureProcessorUnitTestCase.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/annotations/test/AnnotationsScanningWithMetaDataUnitTestCase.xml
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentUnitFilter.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/VFS2BaseBridgeDeploymentUnitFilter.java
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java 2011-03-18 12:00:43 UTC (rev 110968)
+++ projects/jboss-deployers/branches/Branch_2_2/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java 2011-03-18 13:22:11 UTC (rev 110969)
@@ -23,9 +23,12 @@
import java.io.IOException;
import java.net.URISyntaxException;
+import java.util.Collection;
+import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.structure.spi.main.MainDeployerInternals;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
import org.jboss.logging.Logger;
import org.jboss.vfs.VirtualFile;
@@ -50,6 +53,9 @@
/** The structure cache */
private volatile StructureCache<T> cache;
+ /** The missing deployments check */
+ private boolean checkMissingDeployments = true;
+
protected AbstractStructureModificationChecker()
{
}
@@ -171,7 +177,8 @@
{
if (root == null)
throw new IllegalArgumentException("Null root");
- if (deploymentContext == null)
+
+ if (deploymentContext == null && checkMissingDeployments == false)
return false;
// skip vfs deployment context lookup accepted by filter
@@ -186,7 +193,31 @@
return result;
}
}
-
+
+ if (deploymentContext == null && checkMissingDeployments)
+ {
+ Collection<Deployment> missing = getMainDeployerInternals().getMissingDeployer();
+ if (missing != null && missing.isEmpty() == false)
+ {
+ for (Deployment deployment : missing)
+ {
+ if (deployment instanceof VFSDeployment)
+ {
+ VFSDeployment vfsd = (VFSDeployment) deployment;
+ VirtualFile deploymentRoot = vfsd.getRoot();
+ if (root.equals(deploymentRoot))
+ {
+ boolean modified = hasRootBeenModified(root);
+ if (modified)
+ getCache().invalidateCache(root);
+ return modified;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
boolean result = hasDeploymentContextBeenModified(root, deploymentContext);
if (result)
{
@@ -232,13 +263,23 @@
}
/**
+ * Set missing deployments check flag.
+ *
+ * @param checkMissingDeployments the missing deployments check flag
+ */
+ public void setCheckMissingDeployments(boolean checkMissingDeployments)
+ {
+ this.checkMissingDeployments = checkMissingDeployments;
+ }
+
+ /**
* Default root check constraints.
*/
private static class DefaultRootFilter implements ModificationCheckerFilter
{
public boolean accepts(VirtualFile file)
{
- return ! file.isDirectory();
+ return file.isDirectory() == false;
}
public boolean checkRootOnly(VirtualFile root)
More information about the jboss-cvs-commits
mailing list