[jboss-cvs] JBossAS SVN: r84534 - in projects/jboss-deployers/branches/Branch_2_0: deployers-client-spi/src/main/java/org/jboss/deployers/client/spi and 35 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Feb 20 09:46:05 EST 2009
Author: alesj
Date: 2009-02-20 09:46:04 -0500 (Fri, 20 Feb 2009)
New Revision: 84534
Added:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarModificationAction.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/structureprocessor/childmod.jar
Removed:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/structureprocessor/childmod/
Modified:
projects/jboss-deployers/branches/Branch_2_0/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java
projects/jboss-deployers/branches/Branch_2_0/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ModificationType.java
projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java
projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerCheckCompleteTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AttachmentLocator.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/client/VFSDeploymentFactory.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ModificationActions.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/parsing/test/DeployersAltDDTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structureprocessor/test/VFSStructureProcessorUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_0/pom.xml
Log:
Update vfs, mc, cl.
Merge with trunk.
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/IncompleteDeployments.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -30,6 +30,7 @@
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
+import java.util.Iterator;
/**
* IncompleteDeployments.
@@ -261,19 +262,18 @@
// Display all the missing dependencies
if (contextsMissingDependencies.isEmpty() == false)
{
- buffer.append("\n*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}\n\n");
+ buffer.append("\nDEPLOYMENTS MISSING DEPENDENCIES:\n");
for (Map.Entry<String, Set<MissingDependency>> entry : contextsMissingDependencies.entrySet())
{
String name = entry.getKey();
- buffer.append(name).append("\n");
+ buffer.append(String.format(" Deployment \"%s\" is missing the following dependencies:\n", name));
for (MissingDependency dependency : entry.getValue())
{
- buffer.append(" -> ").append(dependency.getDependency());
- buffer.append('{').append(dependency.getRequiredState());
- buffer.append(':').append(dependency.getActualState()).append("}");
- buffer.append("\n");
+ buffer.append(String.format(" Dependency \"%s\" (should be in state \"%s\", but is actually in state \"%s\")\n",
+ dependency.getDependency(),
+ dependency.getRequiredState(),
+ dependency.getActualState()));
}
- buffer.append('\n');
// It is not a root cause if it has missing dependencies
rootCauses.remove(name);
@@ -286,22 +286,19 @@
if (rootCauses.isEmpty() == false)
{
- buffer.append("\n*** CONTEXTS IN ERROR: Name -> Error\n\n");
+ buffer.append("\nDEPLOYMENTS IN ERROR:\n");
for (String key : rootCauses.keySet())
{
- buffer.append(key).append(" -> ");
+ buffer.append(String.format(" Deployment \"%s\" is in error due to the following reason(s): ", key));
Set<String> values = rootCauses.get(key);
- boolean first = true;
- for (String value : values)
+ Iterator<String> it = values.iterator();
+ while (it.hasNext())
{
- if (first == false)
- buffer.append(" | ");
- else
- first = false;
-
- buffer.append(value);
+ buffer.append(it.next());
+ if (it.hasNext())
+ buffer.append(", ");
}
- buffer.append("\n\n");
+ buffer.append("\n");
}
}
contextsInErrorInfo = buffer.toString();
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ModificationType.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ModificationType.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ModificationType.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -33,7 +33,8 @@
{
UNPACK,
EXPLODE,
- TEMP;
+ TEMP,
+ UNJAR;
/**
* Get the modification type.
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/deployers/DeployersImpl.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1448,7 +1448,7 @@
synchronized (this)
{
if (deploymentTimes == null)
- deploymentTimes = new DeployerStatistics();;
+ deploymentTimes = new DeployerStatistics();
String deployerName = deployer.toString();
String deploymentName = unit.getName();
deploymentTimes.addStatistic(deployerName, deploymentName, time);
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -26,8 +26,11 @@
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -102,6 +105,9 @@
private Comparator<DeploymentContext> comparator;
private Comparator<DeploymentContext> reverted;
+ /** The re-deployments */
+ private Map<String, Deployment> toRedeploy = Collections.synchronizedMap(new LinkedHashMap<String, Deployment>());
+
/**
* Set the top deployment context comparator.
*
@@ -111,6 +117,7 @@
{
if (comparator == null)
throw new IllegalArgumentException("Null comparator");
+
this.comparator = comparator;
this.reverted = new RevertedDeploymentContextComparator(comparator);
}
@@ -135,6 +142,7 @@
{
if (deployers == null)
throw new IllegalArgumentException("Null deployers");
+
this.deployers = deployers;
}
@@ -158,6 +166,7 @@
{
if (deployers == null)
throw new IllegalArgumentException("Null deployers");
+
structuralDeployers = deployers;
}
@@ -184,9 +193,10 @@
public Deployment getDeployment(String name)
{
DeploymentContext context = getTopLevelDeploymentContext(name);
- if (context == null)
- return null;
- return context.getDeployment();
+ if (context != null)
+ return context.getDeployment();
+ else
+ return toRedeploy.get(name);
}
@Deprecated
@@ -204,6 +214,7 @@
DeploymentContext context = getDeploymentContext(name);
if (errorNotFound && context == null)
throw new DeploymentException("Context " + name + " not found");
+
return context;
}
@@ -220,6 +231,7 @@
DeploymentUnit unit = getDeploymentUnit(name);
if (errorNotFound && unit == null)
throw new DeploymentException("Unit " + name + " not found");
+
return unit;
}
@@ -233,6 +245,7 @@
{
if (name == null)
throw new IllegalArgumentException("Null name");
+
return topLevelDeployments.get(name);
}
@@ -288,6 +301,69 @@
}
/**
+ * Remove added re-deployments.
+ * This method should take read lock.
+ *
+ * @param names the deployment names to remove
+ * @throws DeploymentException for any error
+ */
+ protected void processToUndeploy(Set<String> names) throws DeploymentException
+ {
+ DeploymentException initialCause = null;
+ for(String name : names)
+ {
+ try
+ {
+ removeDeployment(name, true);
+ }
+ catch (DeploymentException e)
+ {
+ if (initialCause == null)
+ initialCause = e;
+ else
+ log.warn("More exceptions for deployment: " + name, e);
+ }
+ }
+ if (initialCause != null)
+ throw initialCause;
+ }
+
+ /**
+ * Process added re-deployments.
+ * This method should take read lock.
+ *
+ * @param deployments the deployments to process
+ * @throws DeploymentException for any error
+ */
+ protected void processToDeploy(Collection<Deployment> deployments) throws DeploymentException
+ {
+ List<String> added = new ArrayList<String>();
+ try
+ {
+ for (Deployment deployment : deployments)
+ {
+ determineDeploymentContext(deployment, true);
+ added.add(deployment.getName());
+ }
+ }
+ catch (DeploymentException e)
+ {
+ ListIterator<String> iter = added.listIterator(added.size());
+ while (iter.hasPrevious())
+ {
+ try
+ {
+ removeDeployment(iter.previous(), true);
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+ throw e;
+ }
+ }
+
+ /**
* Add a deployment
*
* @param deployment the deployment
@@ -308,51 +384,82 @@
String name = deployment.getName();
log.debug("Add deployment: " + name);
- DeploymentContext previous = topLevelDeployments.get(name);
- boolean topLevelFound = false;
- if (previous != null)
+ // only try to recognize non re-deployments
+ if (checkExistingTopLevelDeployment(deployment, addToDeploy) == false)
{
- log.debug("Removing previous deployment: " + previous.getName());
- removeContext(previous, addToDeploy);
- topLevelFound = true;
+ determineDeploymentContext(deployment, addToDeploy);
}
+ }
+ finally
+ {
+ unlockRead();
+ }
+ }
- if (topLevelFound == false)
- {
- previous = allDeployments.get(name);
- if (previous != null)
- throw new IllegalStateException("Deployment already exists as a subdeployment: " + name);
- }
+ /**
+ * Check for existing deployment context - redeploy.
+ * Method should take read lock.
+ *
+ * @param deployment the deployment
+ * @param addToDeploy should we add this deployment to deploy collection
+ * @return true if deployment is a redeployment, false otherwise
+ */
+ protected boolean checkExistingTopLevelDeployment(Deployment deployment, boolean addToDeploy)
+ {
+ String name = deployment.getName();
+ DeploymentContext previous = topLevelDeployments.get(name);
+ if (previous != null)
+ {
+ log.debug("Removing previous deployment: " + previous.getName());
+ toRedeploy.put(name, deployment);
+ return true;
+ }
+ else
+ {
+ previous = allDeployments.get(name);
+ if (previous != null)
+ throw new IllegalStateException("Deployment already exists as a subdeployment: " + name);
+ }
+ return false;
+ }
- DeploymentContext context = null;
- try
+ /**
+ * Determine deployment context.
+ * Method should take read lock.
+ *
+ * @param deployment the deployment
+ * @param addToDeploy should we add this deployment to deploy collection
+ * @throws DeploymentException for any error
+ */
+ protected void determineDeploymentContext(Deployment deployment, boolean addToDeploy) throws DeploymentException
+ {
+ String name = deployment.getName();
+ DeploymentContext context = null;
+ try
+ {
+ context = determineStructure(deployment);
+ if (DeploymentState.ERROR.equals(context.getState()))
{
- context = determineStructure(deployment);
- if (DeploymentState.ERROR.equals(context.getState()))
- errorDeployments.put(name, context);
-
- context.getTransientAttachments().addAttachment(MainDeployer.class, this);
- topLevelDeployments.put(name, context);
- addContext(context, addToDeploy);
+ errorDeployments.put(name, context);
}
- catch (DeploymentException e)
- {
- missingDeployers.put(name, deployment);
- throw e;
- }
- catch (Throwable t)
- {
- // was structure determined?
- if (context == null)
- missingDeployers.put(name, deployment);
- throw DeploymentException.rethrowAsDeploymentException("Error determining deployment structure for " + name, t);
- }
+ context.getTransientAttachments().addAttachment(MainDeployer.class, this);
+ topLevelDeployments.put(name, context);
+ addContext(context, addToDeploy);
}
- finally
+ catch (DeploymentException e)
{
- unlockRead();
+ missingDeployers.put(name, deployment);
+ throw e;
}
+ catch (Throwable t)
+ {
+ // was structure determined?
+ if (context == null)
+ missingDeployers.put(name, deployment);
+
+ throw DeploymentException.rethrowAsDeploymentException("Error determining deployment structure for " + name, t);
+ }
}
public boolean removeDeployment(Deployment deployment) throws DeploymentException
@@ -540,48 +647,55 @@
if (shutdown.get())
throw new IllegalStateException("The main deployer is shutdown");
+ Map<String, Deployment> copy = new LinkedHashMap<String, Deployment>(toRedeploy);
+ toRedeploy.clear();
+
+ try
+ {
+ processToUndeploy(copy.keySet());
+ }
+ catch (DeploymentException e)
+ {
+ throw new RuntimeException("Error while removing re-deployments", e);
+ }
+
List<DeploymentContext> undeployContexts = null;
- List<DeploymentContext> deployContexts = null;
-
if (undeploy.isEmpty() == false)
{
// Undeploy in reverse order (subdeployments first)
- undeployContexts = new ArrayList<DeploymentContext>(undeploy.size());
- for (int i = undeploy.size() - 1; i >= 0; --i)
- undeployContexts.add(undeploy.get(i));
+ undeployContexts = new ArrayList<DeploymentContext>(undeploy);
+ undeploy.clear();
+ Collections.reverse(undeployContexts);
if (reverted != null)
Collections.sort(undeployContexts, reverted);
- undeploy.clear();
}
- if (deploy.isEmpty() == false)
- {
- deployContexts = new ArrayList<DeploymentContext>(deploy);
- if (comparator != null)
- Collections.sort(deployContexts, comparator);
- deploy.clear();
- }
- if (undeployContexts == null && deployContexts == null)
+ if (undeployContexts != null)
{
- log.debug("Asked to process() when there is nothing to do.");
- return;
+ deployers.process(null, undeployContexts);
}
try
{
- deployers.process(deployContexts, undeployContexts);
+ processToDeploy(copy.values());
}
- catch (RuntimeException e)
+ catch (DeploymentException e)
{
- throw e;
+ throw new RuntimeException("Error while adding re-deployments", e);
}
- catch (Error e)
+
+ List<DeploymentContext> deployContexts = null;
+ if (deploy.isEmpty() == false)
{
- throw e;
+ deployContexts = new ArrayList<DeploymentContext>(deploy);
+ deploy.clear();
+ if (comparator != null)
+ Collections.sort(deployContexts, comparator);
}
- catch (Throwable t)
+
+ if (deployContexts != null)
{
- throw new RuntimeException("Unexpected error in process()", t);
+ deployers.process(deployContexts, null);
}
}
finally
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerCheckCompleteTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerCheckCompleteTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerCheckCompleteTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -100,11 +100,11 @@
try
{
main.addDeployment(deployment);
+ main.process();
}
- catch (DeploymentException ignored)
+ catch (Throwable ignored)
{
}
- main.process();
try
{
main.checkComplete();
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/main/test/DeployerSingleDeploymentTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -84,6 +84,10 @@
String msg = cause.getMessage();
assertEquals(failed, Integer.parseInt(msg));
}
+ finally
+ {
+ mainDeployer.undeploy(deployments);
+ }
deployer.clear();
}
@@ -114,6 +118,10 @@
assertEquals(size, deployer.getUndeployedUnits().size() + deployer.getFailed().size());
assertEquals(Collections.singletonList("deployment" + failed), deployer.getFailed());
}
+ finally
+ {
+ mainDeployer.undeploy(deployments);
+ }
deployer.clear();
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AttachmentLocator.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AttachmentLocator.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AttachmentLocator.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -21,6 +21,8 @@
*/
package org.jboss.deployers.spi.deployer.helpers;
+import java.util.List;
+
import org.jboss.deployers.structure.spi.DeploymentUnit;
/**
@@ -42,8 +44,56 @@
* @return the attachment or null if not present
* @throws IllegalArgumentException for a null name
*/
+ @Deprecated
public static Object search(DeploymentUnit unit, String name)
{
+ return searchAncestors(unit, name);
+ }
+
+ /**
+ * Get named attachment of a given type
+ *
+ * @param <T> the expected type
+ * @param unit the deployment unit
+ * @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
+ */
+ @Deprecated
+ public static <T> T search(DeploymentUnit unit, String name, Class<T> expectedType)
+ {
+ return searchAncestors(unit, name, expectedType);
+ }
+
+ /**
+ * Get an attachment of the given type
+ *
+ * @param <T> the expected type
+ * @param type the type
+ * @param unit the deployment unit
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ @Deprecated
+ public static <T> T search(DeploymentUnit unit, Class<T> type)
+ {
+ if (type == null)
+ throw new IllegalArgumentException("Null expected type.");
+
+ return searchAncestors(unit, type);
+ }
+
+ /**
+ * Get a named attachment, search ancestors
+ *
+ * @param unit the deployment unit
+ * @param name the name of the attachment
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name
+ */
+ public static Object searchAncestors(DeploymentUnit unit, String name)
+ {
Object attachment = null;
while (attachment == null && unit != null)
{
@@ -54,8 +104,8 @@
}
/**
- * Get named attachment of a given type
- *
+ * Get named attachment of a given type, search ancestors
+ *
* @param <T> the expected type
* @param unit the deployment unit
* @param name the name of the attachment
@@ -63,9 +113,9 @@
* @return the attachment or null if not present
* @throws IllegalArgumentException for a null name or expectedType
*/
- public static <T> T search(DeploymentUnit unit, String name, Class<T> expectedType)
+ public static <T> T searchAncestors(DeploymentUnit unit, String name, Class<T> expectedType)
{
- Object result = search(unit, name);
+ Object result = searchAncestors(unit, name);
if (result == null)
return null;
@@ -76,16 +126,97 @@
}
/**
- * Get an attachment of the given type
- *
+ * Get an attachment of the given type, search ancestors
+ *
* @param <T> the expected type
* @param type the type
* @param unit the deployment unit
* @return the attachment or null if not present
* @throws IllegalArgumentException for a null name or type
*/
- public static <T> T search(DeploymentUnit unit, Class<T> type)
+ public static <T> T searchAncestors(DeploymentUnit unit, Class<T> type)
{
- return search(unit, type.getName(), type);
+ if (type == null)
+ throw new IllegalArgumentException("Null expected type.");
+
+ return searchAncestors(unit, type.getName(), type);
}
+
+ /**
+ * Get a named attachment, search in children
+ *
+ * @param unit the deployment unit
+ * @param name the name of the attachment
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name
+ */
+ public static Object searchChildren(DeploymentUnit unit, String name)
+ {
+ Object attachment = unit.getAttachment(name);
+ if (attachment != null)
+ return attachment;
+
+ List<DeploymentUnit> components = unit.getComponents();
+ if (components != null && components.isEmpty() == false)
+ {
+ for (DeploymentUnit component : components)
+ {
+ Object result = searchChildren(component, name);
+ if (result != null)
+ return result;
+ }
+ }
+
+ List<DeploymentUnit> children = unit.getChildren();
+ if (children != null && children.isEmpty() == false)
+ {
+ for (DeploymentUnit child : children)
+ {
+ Object result = searchChildren(child, name);
+ if (result != null)
+ return result;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Get named attachment of a given type, search in children
+ *
+ * @param <T> the expected type
+ * @param unit the deployment unit
+ * @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
+ */
+ public static <T> T searchChildren(DeploymentUnit unit, String name, Class<T> expectedType)
+ {
+ Object result = searchChildren(unit, name);
+ if (result == null)
+ return null;
+
+ if (expectedType == null)
+ throw new IllegalArgumentException("Null expected type.");
+
+ return expectedType.cast(result);
+ }
+
+ /**
+ * Get an attachment of the given type, search in children
+ *
+ * @param <T> the expected type
+ * @param type the type
+ * @param unit the deployment unit
+ * @return the attachment or null if not present
+ * @throws IllegalArgumentException for a null name or type
+ */
+ public static <T> T searchChildren(DeploymentUnit unit, Class<T> type)
+ {
+ if (type == null)
+ throw new IllegalArgumentException("Null expected type.");
+
+ return searchChildren(unit, type.getName(), type);
+ }
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/classloader/UrlIntegrationDeployer.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -130,11 +130,8 @@
}
catch (Throwable t)
{
- List<VirtualFile> classPath = unit.getClassPath();
- for (int i = added.size() - 1; i >=0; i--)
- {
- classPath.remove(added.get(i));
- }
+ Collections.reverse(added);
+ unit.removeClassPath(added.toArray(new VirtualFile[added.size()]));
throw DeploymentException.rethrowAsDeploymentException("Error adding integration path.", t);
}
}
@@ -145,13 +142,12 @@
{
if (isIntegrationDeployment(unit, metaData))
{
- List<VirtualFile> classPath = unit.getClassPath();
for (URL integrationURL : integrationURLs)
{
try
{
VirtualFile integration = VFS.getRoot(integrationURL);
- classPath.remove(integration);
+ unit.removeClassPath(integration);
}
catch (Throwable t)
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/client/DefaultVFSDeploymentFactory.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -23,16 +23,21 @@
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.logging.Logger;
import org.jboss.virtual.VirtualFile;
/**
* DefaultVFSDeploymentFactory.
*
* @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 DefaultVFSDeploymentFactory extends VFSDeploymentFactory
{
+ /** The log */
+ protected Logger log = Logger.getLogger(getClass());
+
@Override
protected VFSDeployment newVFSDeployment(VirtualFile root)
{
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ExplodeTopModificationTypeMatcher.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,40 @@
+/*
+ * 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.deployers.vfs.plugins.structure.modify;
+
+import org.jboss.deployers.spi.structure.ModificationType;
+
+/**
+ * Explode top modification type matcher.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ExplodeTopModificationTypeMatcher extends FileModificationTypeMatcher
+{
+ public ExplodeTopModificationTypeMatcher(String... paths)
+ {
+ super(paths);
+ setCheckChildren(true);
+ setModificationType(ModificationType.EXPLODE);
+ setTopLevelOnly(true);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ModificationActions.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ModificationActions.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/ModificationActions.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -27,6 +27,8 @@
import org.jboss.deployers.spi.structure.ModificationType;
/**
+ * Modification actions.
+ *
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
public class ModificationActions
@@ -39,6 +41,7 @@
actions.put(ModificationType.UNPACK, new UnpackModificationAction());
actions.put(ModificationType.EXPLODE, new ExplodeModificationAction());
actions.put(ModificationType.TEMP, new TempModificationAction());
+ actions.put(ModificationType.UNJAR, new UnjarModificationAction());
}
/**
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarModificationAction.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarModificationAction.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarModificationAction.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarModificationAction.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,41 @@
+/*
+* 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.vfs.plugins.structure.modify;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSUtils;
+
+/**
+ * Unjar modification action.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+class UnjarModificationAction implements ModificationAction
+{
+ public VirtualFile modify(VirtualFile original) throws IOException, URISyntaxException
+ {
+ return VFSUtils.unjar(original);
+ }
+}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/UnjarTopModificationTypeMatcher.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,40 @@
+/*
+ * 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.deployers.vfs.plugins.structure.modify;
+
+import org.jboss.deployers.spi.structure.ModificationType;
+
+/**
+ * Unjar top modification type matcher.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class UnjarTopModificationTypeMatcher extends FileModificationTypeMatcher
+{
+ public UnjarTopModificationTypeMatcher(String... paths)
+ {
+ super(paths);
+ setCheckChildren(true);
+ setModificationType(ModificationType.UNJAR);
+ setTopLevelOnly(true);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -22,6 +22,7 @@
package org.jboss.deployers.vfs.plugins.structure.war;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import org.jboss.deployers.spi.DeploymentException;
@@ -35,18 +36,25 @@
/**
* WARStructure.
- *
+ *
* @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @version $Revision: 83811 $
*/
public class WARStructure extends AbstractVFSStructureDeployer
{
/** The default filter which allows jars/jar directories */
public static final VirtualFileFilter DEFAULT_WEB_INF_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT);
-
+
/** The web-inf/lib filter */
private VirtualFileFilter webInfLibFilter = DEFAULT_WEB_INF_LIB_FILTER;
+ /** The web-inf/lib/[some-archive]/META-INF filter */
+ private VirtualFileFilter webInfLibMetaDataFilter;
+
+ /** Whether to include web-inf in the classpath */
+ private boolean includeWebInfInClasspath;
+
/**
* Sets the default relative order 1000.
*
@@ -58,7 +66,7 @@
/**
* Get the webInfLibFilter.
- *
+ *
* @return the webInfLibFilter.
*/
public VirtualFileFilter getWebInfLibFilter()
@@ -68,7 +76,7 @@
/**
* Set the webInfLibFilter.
- *
+ *
* @param webInfLibFilter the webInfLibFilter.
* @throws IllegalArgumentException for a null filter
*/
@@ -79,6 +87,36 @@
this.webInfLibFilter = webInfLibFilter;
}
+ /**
+ * Get webInfLibMetaDataFilter
+ *
+ * @return the webInfLibMetaDataFilter
+ */
+ public VirtualFileFilter getWebInfLibMetaDataFilter()
+ {
+ return webInfLibMetaDataFilter;
+ }
+
+ /**
+ * Set the webInfLibMetaDataFilter.
+ *
+ * @param webInfLibMetaDataFilter the webInfLibFilter.
+ */
+ public void setWebInfLibMetaDataFilter(VirtualFileFilter webInfLibMetaDataFilter)
+ {
+ this.webInfLibMetaDataFilter = webInfLibMetaDataFilter;
+ }
+
+ /**
+ * Should we include web-inf in classpath.
+ *
+ * @param includeWebInfInClasspath the include web-inf flag
+ */
+ public void setIncludeWebInfInClasspath(boolean includeWebInfInClasspath)
+ {
+ this.includeWebInfInClasspath = includeWebInfInClasspath;
+ }
+
public boolean determineStructure(StructureContext structureContext) throws DeploymentException
{
ContextInfo context = null;
@@ -87,6 +125,9 @@
{
boolean trace = log.isTraceEnabled();
+ // the WEB-INF
+ VirtualFile webinf = null;
+
if (isLeaf(file) == false)
{
// We require either a WEB-INF or the name ends in .war
@@ -94,8 +135,8 @@
{
try
{
- VirtualFile child = file.getChild("WEB-INF");
- if (child != null)
+ webinf = file.getChild("WEB-INF");
+ if (webinf != null)
{
if (trace)
log.trace("... ok - directory has a WEB-INF subdirectory");
@@ -118,44 +159,76 @@
log.trace("... ok - name ends in .war.");
}
- // Create a context for this war file with WEB-INF as the location for metadata
- // Some wars also might have metadata in WEB-INF/classes/META-INF, e.g. persistence.xml
- context = createContext(structureContext, new String[]{"WEB-INF", "WEB-INF/classes/META-INF"});
+ List<String> metaDataLocations = new ArrayList<String>();
+ metaDataLocations.add("WEB-INF");
- // Add the war manifest classpath entries
- addClassPath(structureContext, file, false, true, context);
+ // Check for WEB-INF/classes
+ VirtualFile classes = null;
try
{
- // The classpath is WEB-INF/classes
- VirtualFile classes = file.getChild("WEB-INF/classes");
- // Add the war manifest classpath entries
+ // The classpath contains WEB-INF/classes
+ classes = file.getChild("WEB-INF/classes");
+
+ // Check for a META-INF for metadata
if (classes != null)
- addClassPath(structureContext, classes, true, false, context);
- else if (trace)
- log.trace("No WEB-INF/classes for: " + file.getPathName());
+ metaDataLocations.add("WEB-INF/classes/META-INF");
}
catch(IOException e)
{
log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
}
- // and the top level jars in WEB-INF/lib
+
+ // Check for jars in WEB-INF/lib
+ List<VirtualFile> archives = null;
try
{
VirtualFile webinfLib = file.getChild("WEB-INF/lib");
if (webinfLib != null)
{
- List<VirtualFile> archives = webinfLib.getChildren(webInfLibFilter);
+ archives = webinfLib.getChildren(webInfLibFilter);
+ // Add the jars' META-INF for metadata
for (VirtualFile jar : archives)
- addClassPath(structureContext, jar, true, true, context);
+ {
+ // either same as plain lib filter, null or accepts the jar
+ if (webInfLibMetaDataFilter == null || webInfLibMetaDataFilter == webInfLibFilter || webInfLibMetaDataFilter.accepts(jar))
+ metaDataLocations.add("WEB-INF/lib/" + jar.getName() + "/META-INF");
+ }
}
- else if (trace)
- log.trace("No WEB-INF/lib for: " + file.getPathName());
}
catch (IOException e)
{
log.warn("Exception looking for WEB-INF/lib, " + file.getPathName() + ", " + e);
}
+ // Create a context for this war file and all its metadata locations
+ context = createContext(structureContext, metaDataLocations.toArray(new String[metaDataLocations.size()]));
+
+ // Add the war manifest classpath entries
+ addClassPath(structureContext, file, false, true, context);
+
+ // Add WEB-INF/classes if present
+ if (classes != null)
+ addClassPath(structureContext, classes, true, false, context);
+ else if (trace)
+ log.trace("No WEB-INF/classes for: " + file.getPathName());
+
+ // and the top level jars in WEB-INF/lib
+ if (archives != null)
+ {
+ for (VirtualFile jar : archives)
+ addClassPath(structureContext, jar, true, true, context);
+ }
+ else if (trace)
+ {
+ log.trace("No WEB-INF/lib for: " + file.getPathName());
+ }
+
+ // do we include WEB-INF in classpath
+ if (includeWebInfInClasspath && webinf != null)
+ {
+ addClassPath(structureContext, webinf, true, false, context);
+ }
+
// There are no subdeployments for wars
return true;
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/support/SearchDeployer.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -23,10 +23,13 @@
import java.io.IOException;
import java.net.URL;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.structure.spi.DeploymentUnit;
/**
@@ -42,7 +45,7 @@
private String prefix;
private String suffix;
- private URL[] urls;
+ private Set<URL> urls = new HashSet<URL>();
public SearchDeployer(String prefix, String suffix)
{
@@ -60,7 +63,11 @@
{
try
{
- urls = Classpath.search(unit.getClassLoader(), prefix, suffix);
+ URL[] foundUrls = Classpath.search(unit.getClassLoader(), prefix, suffix);
+ if (foundUrls != null)
+ {
+ urls.addAll(Arrays.asList(foundUrls));
+ }
}
catch (IOException e)
{
@@ -73,7 +80,7 @@
urls = null;
}
- public URL[] getUrls()
+ public Set<URL> getUrls()
{
return urls;
}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/BookingUnitTest.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,155 @@
+/*
+* 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.vfs.deployer.facelets.test;
+
+import java.net.URL;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.classloader.plugins.system.DefaultClassLoaderSystem;
+import org.jboss.classloader.spi.ClassLoaderSystem;
+import org.jboss.classloader.spi.ParentPolicy;
+import org.jboss.classloading.spi.dependency.ClassLoading;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer;
+import org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer;
+import org.jboss.deployers.structure.spi.StructureBuilder;
+import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer;
+import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer;
+import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
+import org.jboss.deployers.vfs.plugins.structure.modify.ModificationTypeStructureProcessor;
+import org.jboss.deployers.vfs.plugins.structure.modify.TempTopModificationTypeMatcher;
+import org.jboss.deployers.vfs.plugins.structure.war.WARStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.test.deployers.vfs.deployer.AbstractDeployerUnitTest;
+import org.jboss.test.deployers.vfs.deployer.facelets.support.SearchDeployer;
+import org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.plugins.cache.IterableTimedVFSCache;
+import org.jboss.virtual.spi.cache.VFSCache;
+import org.jboss.virtual.spi.cache.VFSCacheFactory;
+
+/**
+ * BookingUnitTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class BookingUnitTest extends AbstractDeployerUnitTest
+{
+ private SearchDeployer deployer = new SearchDeployer("META-INF/", ".taglib.xml");
+
+ public BookingUnitTest(String name) throws Throwable
+ {
+ super(name);
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ // Uncomment this to test VFS nested jar copy handling
+ System.setProperty(VFSUtils.FORCE_COPY_KEY, "true");
+
+ VFSCache cache = new IterableTimedVFSCache();
+ cache.start();
+ VFSCacheFactory.setInstance(cache);
+
+ addStructureDeployer(main, new WARStructure());
+ addStructureDeployer(main, new MockEarStructureDeployer());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ VFSCacheFactory.setInstance(null);
+ super.tearDown();
+ }
+
+ protected void addDeployers(Kernel kernel)
+ {
+ ClassLoadingDefaultDeployer cldd = new ClassLoadingDefaultDeployer();
+ ClassLoadingMetaData clmd = new ClassLoadingMetaData();
+ cldd.setDefaultMetaData(clmd);
+
+ VFSClassLoaderClassPathDeployer vfscp = new VFSClassLoaderClassPathDeployer();
+ VFSClassLoaderDescribeDeployer vfsdd = new VFSClassLoaderDescribeDeployer();
+ ClassLoading classLoading = new ClassLoading();
+ KernelController controller = kernel.getController();
+ BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder("ClassLoading", ClassLoading.class.getName());
+ builder.addMethodInstallCallback("addModule");
+ builder.addMethodUninstallCallback("removeModule");
+ try
+ {
+ controller.install(builder.getBeanMetaData(), classLoading);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ vfsdd.setClassLoading(classLoading);
+
+ ClassLoaderSystem system = new DefaultClassLoaderSystem();
+ system.getDefaultDomain().setParentPolicy(ParentPolicy.BEFORE_BUT_JAVA_ONLY);
+
+ AbstractLevelClassLoaderSystemDeployer clsd = new AbstractLevelClassLoaderSystemDeployer();
+ clsd.setClassLoading(classLoading);
+ clsd.setSystem(system);
+
+ addDeployer(main, cldd);
+ addDeployer(main, vfsdd);
+ addDeployer(main, vfscp);
+ addDeployer(main, clsd);
+ addDeployer(main, deployer);
+ }
+
+ @Override
+ protected StructureBuilder createStructureBuilder()
+ {
+ VFSStructureBuilder structureBuilder = (VFSStructureBuilder)super.createStructureBuilder();
+ ModificationTypeStructureProcessor sp = new ModificationTypeStructureProcessor();
+ sp.addMatcher(new TempTopModificationTypeMatcher("META-INF/components.xml"));
+ structureBuilder.setStructureProcessor(sp);
+ return structureBuilder;
+ }
+
+ protected void testFacelets(String name, int size) throws Throwable
+ {
+ VFSDeployment context = createDeployment("/facelets", name);
+ assertDeploy(context);
+ try
+ {
+ Set<URL> urls = deployer.getUrls();
+ assertNotNull(urls);
+ assertEquals(size, urls.size());
+ }
+ finally
+ {
+ assertUndeploy(context);
+ }
+ }
+
+ public void testBooking() throws Throwable
+ {
+ testFacelets("booking.ear", 11);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/facelets/test/FaceletsUnitTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -22,6 +22,7 @@
package org.jboss.test.deployers.vfs.deployer.facelets.test;
import java.net.URL;
+import java.util.Set;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -112,9 +113,9 @@
assertDeploy(context);
try
{
- URL[] urls = deployer.getUrls();
+ Set<URL> urls = deployer.getUrls();
assertNotNull(urls);
- assertEquals(size, urls.length);
+ assertEquals(size, urls.size());
}
finally
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/support/MyVirtualFile.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -117,6 +117,11 @@
return true;
}
+ public boolean isArchive() throws IOException
+ {
+ return false;
+ }
+
public boolean isHidden() throws IOException
{
return false;
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,53 +0,0 @@
-/*
-* 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.vfs.jmx;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-import org.jboss.test.deployers.vfs.jmx.test.ComplexJMXTestCase;
-import org.jboss.test.deployers.vfs.jmx.test.SimpleJMXTestCase;
-
-/**
- * JMXTestSuite.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class JMXTestSuite extends TestSuite
-{
- public static void main(String[] args)
- {
- TestRunner.run(suite());
- }
-
- public static Test suite()
- {
- TestSuite suite = new TestSuite("JMX Tests");
-
- suite.addTest(SimpleJMXTestCase.suite());
- suite.addTest(ComplexJMXTestCase.suite());
-
- return suite;
- }
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/JMXTestSuite.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,53 @@
+/*
+* 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.vfs.jmx;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.jboss.test.deployers.vfs.jmx.test.ComplexJMXTestCase;
+import org.jboss.test.deployers.vfs.jmx.test.SimpleJMXTestCase;
+
+/**
+ * JMXTestSuite.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JMXTestSuite extends TestSuite
+{
+ public static void main(String[] args)
+ {
+ TestRunner.run(suite());
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite("JMX Tests");
+
+ suite.addTest(SimpleJMXTestCase.suite());
+ suite.addTest(ComplexJMXTestCase.suite());
+
+ return suite;
+ }
+}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,167 +0,0 @@
-/*
- * 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.test.deployers.vfs.jmx.test;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.ObjectName;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.test.deployers.BootstrapDeployersTest;
-import org.jboss.test.deployers.BootstrapDeployersTestDelegate;
-
-/**
- * AbstractJMXBootstrapTest.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public abstract class AbstractJMXBootstrapTest extends BootstrapDeployersTest
-{
- public AbstractJMXBootstrapTest(String name)
- {
- super(name);
- }
-
- public static BootstrapDeployersTestDelegate getDelegate(Class<?> clazz) throws Exception
- {
- BootstrapDeployersTestDelegate delegate = BootstrapDeployersTest.getDelegate(clazz);
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- delegate.setMBeanServer(server);
- return delegate;
- }
-
- protected MBeanServer getMBeanServer()
- {
- return getDelegate().getMBeanServer();
- }
-
- protected Set<ObjectName> assertMBeans(DeploymentUnit unit) throws Exception
- {
- Set<ObjectName> names = new HashSet<ObjectName>();
- assertTopLevelMBean(unit, names);
- for (DeploymentUnit child : unit.getChildren())
- assertSubDeploymentMBean(child, names);
- for (DeploymentUnit component : unit.getComponents())
- assertComponentMBean(component, names);
- return names;
- }
-
- protected void assertNoMBeans(Set<ObjectName> names) throws Exception
- {
- for (ObjectName objectName : names)
- {
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
- }
- }
-
- protected void assertNoMBeans(DeploymentUnit unit) throws Exception
- {
- assertNoTopLevelMBean(unit);
- for (DeploymentUnit child : unit.getChildren())
- assertNoSubDeploymentMBean(child);
- for (DeploymentUnit component : unit.getComponents())
- assertNoComponentMBean(component);
- }
-
- protected void assertTopLevelMBean(DeploymentUnit unit, Set<ObjectName> names) throws Exception
- {
- ObjectName objectName = getTopLevelObjectName(unit);
- names.add(objectName);
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertTrue(objectName + " should be registered with the MBeanServer", result);
- }
-
- protected void assertNoTopLevelMBean(DeploymentUnit unit) throws Exception
- {
- ObjectName objectName = getTopLevelObjectName(unit);
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
- }
-
- protected ObjectName getTopLevelObjectName(DeploymentUnit unit) throws Exception
- {
- String name = unit.getName();
- return new ObjectName("jboss.deployment:id=\"" + name + "\",type=Deployment");
- }
-
- protected void assertSubDeploymentMBean(DeploymentUnit unit, Set<ObjectName> names) throws Exception
- {
- ObjectName objectName = getSubDeploymentObjectName(unit);
- names.add(objectName);
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertTrue(objectName + " should be registered with the MBeanServer", result);
- for (DeploymentUnit child : unit.getChildren())
- assertSubDeploymentMBean(child, names);
- for (DeploymentUnit component : unit.getComponents())
- assertComponentMBean(component, names);
- }
-
- protected void assertNoSubDeploymentMBean(DeploymentUnit unit) throws Exception
- {
- ObjectName objectName = getSubDeploymentObjectName(unit);
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
- for (DeploymentUnit child : unit.getChildren())
- assertNoSubDeploymentMBean(child);
- for (DeploymentUnit component : unit.getComponents())
- assertNoComponentMBean(component);
- }
-
- protected ObjectName getSubDeploymentObjectName(DeploymentUnit unit) throws Exception
- {
- String name = unit.getName();
- return new ObjectName("jboss.deployment:id=\"" + name + "\",type=SubDeployment");
- }
-
- protected void assertComponentMBean(DeploymentUnit unit, Set<ObjectName> names) throws Exception
- {
- ObjectName objectName = getComponentObjectName(unit);
- names.add(objectName);
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertTrue(objectName + " should be registered with the MBeanServer", result);
- }
-
- protected void assertNoComponentMBean(DeploymentUnit unit) throws Exception
- {
- ObjectName objectName = getComponentObjectName(unit);
- boolean result = getMBeanServer().isRegistered(objectName);
- getLog().debug(objectName + " isRegistered=" + result);
- assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
- }
-
- protected ObjectName getComponentObjectName(DeploymentUnit unit) throws Exception
- {
- String name = unit.getName();
- return new ObjectName("jboss.deployment:id=\"" + name + "\",type=Component");
- }
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/AbstractJMXBootstrapTest.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,167 @@
+/*
+ * 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.test.deployers.vfs.jmx.test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.test.deployers.BootstrapDeployersTestDelegate;
+
+/**
+ * AbstractJMXBootstrapTest.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractJMXBootstrapTest extends BootstrapDeployersTest
+{
+ public AbstractJMXBootstrapTest(String name)
+ {
+ super(name);
+ }
+
+ public static BootstrapDeployersTestDelegate getDelegate(Class<?> clazz) throws Exception
+ {
+ BootstrapDeployersTestDelegate delegate = BootstrapDeployersTest.getDelegate(clazz);
+ MBeanServer server = MBeanServerFactory.newMBeanServer();
+ delegate.setMBeanServer(server);
+ return delegate;
+ }
+
+ protected MBeanServer getMBeanServer()
+ {
+ return getDelegate().getMBeanServer();
+ }
+
+ protected Set<ObjectName> assertMBeans(DeploymentUnit unit) throws Exception
+ {
+ Set<ObjectName> names = new HashSet<ObjectName>();
+ assertTopLevelMBean(unit, names);
+ for (DeploymentUnit child : unit.getChildren())
+ assertSubDeploymentMBean(child, names);
+ for (DeploymentUnit component : unit.getComponents())
+ assertComponentMBean(component, names);
+ return names;
+ }
+
+ protected void assertNoMBeans(Set<ObjectName> names) throws Exception
+ {
+ for (ObjectName objectName : names)
+ {
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
+ }
+ }
+
+ protected void assertNoMBeans(DeploymentUnit unit) throws Exception
+ {
+ assertNoTopLevelMBean(unit);
+ for (DeploymentUnit child : unit.getChildren())
+ assertNoSubDeploymentMBean(child);
+ for (DeploymentUnit component : unit.getComponents())
+ assertNoComponentMBean(component);
+ }
+
+ protected void assertTopLevelMBean(DeploymentUnit unit, Set<ObjectName> names) throws Exception
+ {
+ ObjectName objectName = getTopLevelObjectName(unit);
+ names.add(objectName);
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertTrue(objectName + " should be registered with the MBeanServer", result);
+ }
+
+ protected void assertNoTopLevelMBean(DeploymentUnit unit) throws Exception
+ {
+ ObjectName objectName = getTopLevelObjectName(unit);
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
+ }
+
+ protected ObjectName getTopLevelObjectName(DeploymentUnit unit) throws Exception
+ {
+ String name = unit.getName();
+ return new ObjectName("jboss.deployment:id=\"" + name + "\",type=Deployment");
+ }
+
+ protected void assertSubDeploymentMBean(DeploymentUnit unit, Set<ObjectName> names) throws Exception
+ {
+ ObjectName objectName = getSubDeploymentObjectName(unit);
+ names.add(objectName);
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertTrue(objectName + " should be registered with the MBeanServer", result);
+ for (DeploymentUnit child : unit.getChildren())
+ assertSubDeploymentMBean(child, names);
+ for (DeploymentUnit component : unit.getComponents())
+ assertComponentMBean(component, names);
+ }
+
+ protected void assertNoSubDeploymentMBean(DeploymentUnit unit) throws Exception
+ {
+ ObjectName objectName = getSubDeploymentObjectName(unit);
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
+ for (DeploymentUnit child : unit.getChildren())
+ assertNoSubDeploymentMBean(child);
+ for (DeploymentUnit component : unit.getComponents())
+ assertNoComponentMBean(component);
+ }
+
+ protected ObjectName getSubDeploymentObjectName(DeploymentUnit unit) throws Exception
+ {
+ String name = unit.getName();
+ return new ObjectName("jboss.deployment:id=\"" + name + "\",type=SubDeployment");
+ }
+
+ protected void assertComponentMBean(DeploymentUnit unit, Set<ObjectName> names) throws Exception
+ {
+ ObjectName objectName = getComponentObjectName(unit);
+ names.add(objectName);
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertTrue(objectName + " should be registered with the MBeanServer", result);
+ }
+
+ protected void assertNoComponentMBean(DeploymentUnit unit) throws Exception
+ {
+ ObjectName objectName = getComponentObjectName(unit);
+ boolean result = getMBeanServer().isRegistered(objectName);
+ getLog().debug(objectName + " isRegistered=" + result);
+ assertFalse(objectName + " should NOT be registered with the MBeanServer", result);
+ }
+
+ protected ObjectName getComponentObjectName(DeploymentUnit unit) throws Exception
+ {
+ String name = unit.getName();
+ return new ObjectName("jboss.deployment:id=\"" + name + "\",type=Component");
+ }
+}
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,65 +0,0 @@
-/*
-* 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.vfs.jmx.test;
-
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-
-/**
- * ComplexJMXTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ComplexJMXTestCase extends AbstractJMXBootstrapTest
-{
- public ComplexJMXTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(ComplexJMXTestCase.class);
- }
-
- public void testComplexJMX() throws Exception
- {
- DeploymentUnit unit = addDeployment("/jmx", "complex.jar");
- Set<ObjectName> names = null;
- try
- {
- getDeployerClient().checkComplete();
- names = assertMBeans(unit);
- }
- finally
- {
- undeploy(unit);
- }
- assertNoMBeans(names);
- }
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/ComplexJMXTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,65 @@
+/*
+* 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.vfs.jmx.test;
+
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * ComplexJMXTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ComplexJMXTestCase extends AbstractJMXBootstrapTest
+{
+ public ComplexJMXTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(ComplexJMXTestCase.class);
+ }
+
+ public void testComplexJMX() throws Exception
+ {
+ DeploymentUnit unit = addDeployment("/jmx", "complex.jar");
+ Set<ObjectName> names = null;
+ try
+ {
+ getDeployerClient().checkComplete();
+ names = assertMBeans(unit);
+ }
+ finally
+ {
+ undeploy(unit);
+ }
+ assertNoMBeans(names);
+ }
+}
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,65 +0,0 @@
-/*
-* 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.vfs.jmx.test;
-
-import java.util.Set;
-
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-
-/**
- * SimpleJMXTestCase.
- *
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class SimpleJMXTestCase extends AbstractJMXBootstrapTest
-{
- public SimpleJMXTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(SimpleJMXTestCase.class);
- }
-
- public void testSimpleJMX() throws Exception
- {
- DeploymentUnit unit = addDeployment("/jmx", "simple.jar");
- Set<ObjectName> names = null;
- try
- {
- getDeployerClient().checkComplete();
- names = assertMBeans(unit);
- }
- finally
- {
- undeploy(unit);
- }
- assertNoMBeans(names);
- }
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/jmx/test/SimpleJMXTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,65 @@
+/*
+* 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.vfs.jmx.test;
+
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+
+/**
+ * SimpleJMXTestCase.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleJMXTestCase extends AbstractJMXBootstrapTest
+{
+ public SimpleJMXTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(SimpleJMXTestCase.class);
+ }
+
+ public void testSimpleJMX() throws Exception
+ {
+ DeploymentUnit unit = addDeployment("/jmx", "simple.jar");
+ Set<ObjectName> names = null;
+ try
+ {
+ getDeployerClient().checkComplete();
+ names = assertMBeans(unit);
+ }
+ finally
+ {
+ undeploy(unit);
+ }
+ assertNoMBeans(names);
+ }
+}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/parsing/test/DeployersAltDDTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/parsing/test/DeployersAltDDTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/parsing/test/DeployersAltDDTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -156,6 +156,11 @@
return false;
}
+ public boolean isArchive() throws IOException
+ {
+ return false;
+ }
+
public String getLocalPathName()
{
return null;
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/AbstractStructureTest.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -58,7 +58,8 @@
protected void assertUnpacked(VirtualFile file) throws Exception
{
- assertSame(file, VFSUtils.unpack(file));
+ VirtualFile modified = VFSUtils.unpack(file);
+ assertTrue(VFSUtils.isTemporaryFile(modified));
}
protected void assertNoChildContexts(VFSDeploymentContext context)
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -43,6 +43,7 @@
import org.jboss.test.deployers.vfs.structure.war.test.CombinedWARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.WARStructureUnitTestCase;
import org.jboss.test.deployers.vfs.structure.war.test.WARUnpackUnitTestCase;
+import org.jboss.test.deployers.vfs.structure.modified.test.MetaDataStructureModificationTestCase;
/**
* VFSStructureTestSuite.
@@ -81,6 +82,7 @@
suite.addTest(InnerModificationUnitTestCase.suite());
suite.addTest(DirStructureUnitTestCase.suite());
suite.addTest(RealDirStructureUnitTestCase.suite());
+ suite.addTest(MetaDataStructureModificationTestCase.suite());
return suite;
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/file/test/FileMatcherTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -166,6 +166,11 @@
return false;
}
+ public boolean isArchive() throws IOException
+ {
+ return false;
+ }
+
public boolean isHidden() throws IOException
{
return false;
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,38 +0,0 @@
-/*
- * 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.test.deployers.vfs.structure.modified.support;
-
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Include only .xml files.
- *
- * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
- */
-public class XmlIncludeVirtualFileFilter implements VirtualFileFilter
-{
- public boolean accepts(VirtualFile file)
- {
- return file.getName().endsWith(".xml");
- }
-}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/XmlIncludeVirtualFileFilter.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.deployers.vfs.structure.modified.support;
+
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Include only .xml files.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class XmlIncludeVirtualFileFilter implements VirtualFileFilter
+{
+ public boolean accepts(VirtualFile file)
+ {
+ return file.getName().endsWith(".xml");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,170 +0,0 @@
-/*
- * 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.test.deployers.vfs.structure.modified.test;
-
-import java.io.File;
-import java.net.URL;
-
-import junit.framework.Test;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker;
-import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
-import org.jboss.test.deployers.vfs.structure.modified.support.XmlIncludeVirtualFileFilter;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Test StructureModificationChecker.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MetaDataStructureModificationTestCase extends StructureModificationTest
-{
- public MetaDataStructureModificationTestCase(String name)
- {
- super(name);
- }
-
- public static Test suite()
- {
- return suite(MetaDataStructureModificationTestCase.class);
- }
-
- protected StructureModificationChecker createStructureModificationChecker(MainDeployerStructure mainDeployerStructure, VirtualFileFilter filter)
- {
- MetaDataStructureModificationChecker structureModificationChecker = new MetaDataStructureModificationChecker(mainDeployerStructure);
- structureModificationChecker.setFilter(filter);
- return structureModificationChecker;
- }
-
- protected VirtualFileFilter createFilter()
- {
- return new XmlIncludeVirtualFileFilter();
- }
-
- protected void testStructureModified(AssembledDirectory ear, StructureModificationChecker checker, VFSDeploymentUnit deploymentUnit) throws Exception
- {
- VirtualFile root = deploymentUnit.getRoot();
- // initial run
- assertFalse(checker.hasStructureBeenModified(root));
- // already cached run
- assertFalse(checker.hasStructureBeenModified(root));
-
- AssembledDirectory jar = (AssembledDirectory)ear.getChild("simple.jar");
- AssembledDirectory jarMD = (AssembledDirectory)jar.getChild("META-INF");
-
- // 'update' web-beans.xml
- URL url = getResource("/webbeans/simple/jar/META-INF/web-beans.xml");
- assertNotNull(url);
- File file = new File(url.toURI());
- assertTrue(file.setLastModified(System.currentTimeMillis()));
- assertTrue(checker.hasStructureBeenModified(root));
- // should be the same
- assertFalse(checker.hasStructureBeenModified(root));
-
- // add new xml
- url = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
- assertNotNull(url);
- jarMD.addChild(VFS.createNewRoot(url));
- assertTrue(checker.hasStructureBeenModified(root));
- // should be the same
- assertFalse(checker.hasStructureBeenModified(root));
-
- // 'remove' new xml
- jarMD = jar.mkdir("META-INF");
- url = getResource("/dependency/module/META-INF/jboss-dependency.xml");
- assertNotNull(url);
- jarMD.addChild(VFS.createNewRoot(url));
- url = getResource("/webbeans/simple/ejb/META-INF/web-beans.xml");
- assertNotNull(url);
- jarMD.addChild(VFS.createNewRoot(url));
- assertTrue(checker.hasStructureBeenModified(root));
- // should be the same
- assertFalse(checker.hasStructureBeenModified(root));
-
- // 'remove' whole metadata dir
- jar.mkdir("META-INF");
- assertTrue(checker.hasStructureBeenModified(root));
- }
-
- public void testInitialEmptyDir() throws Exception
- {
- AssembledDirectory top = createAssembledDirectory("top.jar", "top.jar");
- AssembledDirectory metainf = top.mkdir("META-INF");
- StructureModificationChecker checker = createStructureModificationChecker();
-
- VFSDeploymentUnit vdu = assertDeploy(top);
- try
- {
- VirtualFile root = vdu.getRoot();
- assertFalse(checker.hasStructureBeenModified(root));
-
- URL url = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
- assertNotNull(url);
- metainf.addChild(VFS.createNewRoot(url));
- assertTrue(checker.hasStructureBeenModified(root));
- }
- finally
- {
- undeploy(vdu);
- }
- }
-
- public void testMultipleChanges() throws Exception
- {
- AssembledDirectory top = createAssembledDirectory("top.jar", "top.jar");
- AssembledDirectory metainf = top.mkdir("META-INF");
- StructureModificationChecker checker = createStructureModificationChecker();
-
- VFSDeploymentUnit vdu = assertDeploy(top);
- try
- {
- VirtualFile root = vdu.getRoot();
- assertFalse(checker.hasStructureBeenModified(root));
-
- URL url1 = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
- assertNotNull(url1);
- metainf.addChild(VFS.createNewRoot(url1));
- URL url2 = getResource("/dependency/module/META-INF/jboss-dependency.xml");
- assertNotNull(url2);
- metainf.addChild(VFS.createNewRoot(url2));
-
- assertTrue(checker.hasStructureBeenModified(root));
- assertFalse(checker.hasStructureBeenModified(root));
-
- File f1 = new File(url1.toURI());
- assertTrue(f1.setLastModified(System.currentTimeMillis()));
- File f2 = new File(url2.toURI());
- assertTrue(f2.setLastModified(System.currentTimeMillis()));
-
- assertTrue(checker.hasStructureBeenModified(root));
- assertFalse(checker.hasStructureBeenModified(root));
- }
- finally
- {
- undeploy(vdu);
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,170 @@
+/*
+ * 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.test.deployers.vfs.structure.modified.test;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.Test;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.modified.MetaDataStructureModificationChecker;
+import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
+import org.jboss.test.deployers.vfs.structure.modified.support.XmlIncludeVirtualFileFilter;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Test StructureModificationChecker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MetaDataStructureModificationTestCase extends StructureModificationTest
+{
+ public MetaDataStructureModificationTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(MetaDataStructureModificationTestCase.class);
+ }
+
+ protected StructureModificationChecker createStructureModificationChecker(MainDeployerStructure mainDeployerStructure, VirtualFileFilter filter)
+ {
+ MetaDataStructureModificationChecker structureModificationChecker = new MetaDataStructureModificationChecker(mainDeployerStructure);
+ structureModificationChecker.setFilter(filter);
+ return structureModificationChecker;
+ }
+
+ protected VirtualFileFilter createFilter()
+ {
+ return new XmlIncludeVirtualFileFilter();
+ }
+
+ protected void testStructureModified(AssembledDirectory ear, StructureModificationChecker checker, VFSDeploymentUnit deploymentUnit) throws Exception
+ {
+ VirtualFile root = deploymentUnit.getRoot();
+ // initial run
+ assertFalse(checker.hasStructureBeenModified(root));
+ // already cached run
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ AssembledDirectory jar = (AssembledDirectory)ear.getChild("simple.jar");
+ AssembledDirectory jarMD = (AssembledDirectory)jar.getChild("META-INF");
+
+ // 'update' web-beans.xml
+ URL url = getResource("/webbeans/simple/jar/META-INF/web-beans.xml");
+ assertNotNull(url);
+ File file = new File(url.toURI());
+ assertTrue(file.setLastModified(System.currentTimeMillis()));
+ assertTrue(checker.hasStructureBeenModified(root));
+ // should be the same
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ // add new xml
+ url = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
+ assertNotNull(url);
+ jarMD.addChild(VFS.createNewRoot(url));
+ assertTrue(checker.hasStructureBeenModified(root));
+ // should be the same
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ // 'remove' new xml
+ jarMD = jar.mkdir("META-INF");
+ url = getResource("/dependency/module/META-INF/jboss-dependency.xml");
+ assertNotNull(url);
+ jarMD.addChild(VFS.createNewRoot(url));
+ url = getResource("/webbeans/simple/ejb/META-INF/web-beans.xml");
+ assertNotNull(url);
+ jarMD.addChild(VFS.createNewRoot(url));
+ assertTrue(checker.hasStructureBeenModified(root));
+ // should be the same
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ // 'remove' whole metadata dir
+ jar.mkdir("META-INF");
+ assertTrue(checker.hasStructureBeenModified(root));
+ }
+
+ public void testInitialEmptyDir() throws Exception
+ {
+ AssembledDirectory top = createAssembledDirectory("top.jar", "top.jar");
+ AssembledDirectory metainf = top.mkdir("META-INF");
+ StructureModificationChecker checker = createStructureModificationChecker();
+
+ VFSDeploymentUnit vdu = assertDeploy(top);
+ try
+ {
+ VirtualFile root = vdu.getRoot();
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ URL url = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
+ assertNotNull(url);
+ metainf.addChild(VFS.createNewRoot(url));
+ assertTrue(checker.hasStructureBeenModified(root));
+ }
+ finally
+ {
+ undeploy(vdu);
+ }
+ }
+
+ public void testMultipleChanges() throws Exception
+ {
+ AssembledDirectory top = createAssembledDirectory("top.jar", "top.jar");
+ AssembledDirectory metainf = top.mkdir("META-INF");
+ StructureModificationChecker checker = createStructureModificationChecker();
+
+ VFSDeploymentUnit vdu = assertDeploy(top);
+ try
+ {
+ VirtualFile root = vdu.getRoot();
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ URL url1 = getResource("/scanning/smoke/META-INF/jboss-scanning.xml");
+ assertNotNull(url1);
+ metainf.addChild(VFS.createNewRoot(url1));
+ URL url2 = getResource("/dependency/module/META-INF/jboss-dependency.xml");
+ assertNotNull(url2);
+ metainf.addChild(VFS.createNewRoot(url2));
+
+ assertTrue(checker.hasStructureBeenModified(root));
+ assertFalse(checker.hasStructureBeenModified(root));
+
+ File f1 = new File(url1.toURI());
+ assertTrue(f1.setLastModified(System.currentTimeMillis()));
+ File f2 = new File(url2.toURI());
+ assertTrue(f2.setLastModified(System.currentTimeMillis()));
+
+ assertTrue(checker.hasStructureBeenModified(root));
+ assertFalse(checker.hasStructureBeenModified(root));
+ }
+ finally
+ {
+ undeploy(vdu);
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,71 +0,0 @@
-/*
- * 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.test.deployers.vfs.structure.modified.test;
-
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.test.deployers.vfs.webbeans.test.AbstractWebBeansTest;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * Test StructureModificationChecker.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class StructureModificationTest extends AbstractWebBeansTest
-{
- protected StructureModificationTest(String name)
- {
- super(name);
- }
-
- protected StructureModificationChecker createStructureModificationChecker()
- {
- MainDeployerStructure mainDeployer = assertBean("MainDeployer", MainDeployerStructure.class);
- VirtualFileFilter filter = createFilter();
- return createStructureModificationChecker(mainDeployer, filter);
- }
-
- protected abstract StructureModificationChecker createStructureModificationChecker(MainDeployerStructure mainDeployerStructure, VirtualFileFilter filter);
-
- protected abstract VirtualFileFilter createFilter();
-
- public void testDoBasicTest() throws Exception
- {
- AssembledDirectory ear = createBasicEar();
- StructureModificationChecker checker = createStructureModificationChecker();
-
- VFSDeploymentUnit deploymentUnit = assertDeploy(ear);
- try
- {
- testStructureModified(ear, checker, deploymentUnit);
- }
- finally
- {
- undeploy(deploymentUnit);
- }
- }
-
- protected abstract void testStructureModified(AssembledDirectory ear, StructureModificationChecker checker, VFSDeploymentUnit deploymentUnit) throws Exception;
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,71 @@
+/*
+ * 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.test.deployers.vfs.structure.modified.test;
+
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.test.deployers.vfs.webbeans.test.AbstractWebBeansTest;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * Test StructureModificationChecker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class StructureModificationTest extends AbstractWebBeansTest
+{
+ protected StructureModificationTest(String name)
+ {
+ super(name);
+ }
+
+ protected StructureModificationChecker createStructureModificationChecker()
+ {
+ MainDeployerStructure mainDeployer = assertBean("MainDeployer", MainDeployerStructure.class);
+ VirtualFileFilter filter = createFilter();
+ return createStructureModificationChecker(mainDeployer, filter);
+ }
+
+ protected abstract StructureModificationChecker createStructureModificationChecker(MainDeployerStructure mainDeployerStructure, VirtualFileFilter filter);
+
+ protected abstract VirtualFileFilter createFilter();
+
+ public void testDoBasicTest() throws Exception
+ {
+ AssembledDirectory ear = createBasicEar();
+ StructureModificationChecker checker = createStructureModificationChecker();
+
+ VFSDeploymentUnit deploymentUnit = assertDeploy(ear);
+ try
+ {
+ testStructureModified(ear, checker, deploymentUnit);
+ }
+ finally
+ {
+ undeploy(deploymentUnit);
+ }
+ }
+
+ protected abstract void testStructureModified(AssembledDirectory ear, StructureModificationChecker checker, VFSDeploymentUnit deploymentUnit) throws Exception;
+}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/war/test/WARUnpackUnitTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -27,6 +27,8 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
import org.jboss.test.deployers.vfs.structure.AbstractStructureTest;
import org.jboss.test.deployers.vfs.structure.support.WarUnpackStructure;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
/**
* WARUnpackUnitTestCase.
@@ -53,6 +55,7 @@
public void testWarDeployerUnpack() throws Throwable
{
VFSDeploymentContext root = assertDeploy("/structure/war/simple", "simple.war");
- assertUnpacked(root.getRoot());
+ VirtualFile file = root.getRoot();
+ assertSame(file, VFSUtils.unpack(file));
}
}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structureprocessor/test/VFSStructureProcessorUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structureprocessor/test/VFSStructureProcessorUnitTestCase.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structureprocessor/test/VFSStructureProcessorUnitTestCase.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -61,15 +61,16 @@
{
ModificationTypeStructureProcessor mtsp = new ModificationTypeStructureProcessor();
- ModificationTypeMatcher topAndChildren = createTempMatcher(true, true, false, true, "child.xml");
- ModificationTypeMatcher directTop = createTempMatcher(true, false, true, false, "top.xml");
- ModificationTypeMatcher justChildren = createTempMatcher(true, false, false, true, "sub.xml");
+ ModificationTypeMatcher topAndChildren = createTempMatcher(ModificationType.TEMP, true, true, true, false, "child.xml");
+ ModificationTypeMatcher directTop = createTempMatcher(ModificationType.TEMP, true, false, true, false, "top.xml");
+ ModificationTypeMatcher justChildren = createTempMatcher(ModificationType.UNPACK, true, false, false, true, "sub.xml");
- mtsp.setMatchers(Arrays.asList(directTop, topAndChildren, justChildren));
+ mtsp.setMatchers(Arrays.asList(topAndChildren, directTop, justChildren));
return mtsp;
}
protected ModificationTypeMatcher createTempMatcher(
+ ModificationType type,
boolean metadataOnly,
boolean checkChildren,
boolean topLevelOnly,
@@ -77,7 +78,7 @@
String... paths)
{
FileModificationTypeMatcher matcher = new FileModificationTypeMatcher(paths);
- matcher.setModificationType(ModificationType.TEMP);
+ matcher.setModificationType(type);
matcher.setMetadataOnly(metadataOnly);
matcher.setCheckChildren(checkChildren);
matcher.setTopLevelOnly(topLevelOnly);
@@ -131,13 +132,13 @@
DeployerClient main = createMainDeployer();
addStructureDeployer(main, new JARStructure());
- VFSDeployment deployment = createDeployment("/structureprocessor", "childmod");
+ VFSDeployment deployment = createDeployment("/structureprocessor", "childmod.jar");
main.deploy(deployment);
try
{
- VFSDeploymentContext vdc = getTopDeploymentContext(main, "childmod");
+ VFSDeploymentContext vdc = getTopDeploymentContext(main, "childmod.jar");
VirtualFile root = vdc.getRoot();
- VirtualFile file = root.getChild("tempchild");
+ VirtualFile file = root.getChild("tempchild.jar");
try
{
assertTrue("Should be temp", VFSUtils.isTemporaryFile(file));
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="Complex1" class="java.lang.Object"/>
-</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/META-INF/jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Complex1" class="java.lang.Object"/>
+</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="Inner1" class="java.lang.Object"/>
-</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/META-INF/jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Inner1" class="java.lang.Object"/>
+</deployment>
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="My1" class="java.lang.Object"/>
-</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/complex.jar/inner.jar/my-jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="My1" class="java.lang.Object"/>
+</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/simple.jar)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="Simple1" class="java.lang.Object"/>
-</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/jmx/simple.jar/META-INF/jboss-beans.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <bean name="Simple1" class="java.lang.Object"/>
+</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/structureprocessor/childmod.jar (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/structureprocessor/childmod.jar)
===================================================================
(Binary files differ)
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/client/VFSDeploymentFactory.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/client/VFSDeploymentFactory.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/client/VFSDeploymentFactory.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -28,6 +28,7 @@
* VFSDeploymentFactory.
*
* @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 abstract class VFSDeploymentFactory extends DeploymentFactory
@@ -41,7 +42,7 @@
{
return VFSDeploymentBuilder.getInstance();
}
-
+
/**
* Create a new VFS deployment
*
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,200 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * AbstractStructureModificationChecker.
- *
- * @param <T> exact cache value type
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public abstract class AbstractStructureModificationChecker<T> implements StructureModificationChecker
-{
- /** The log */
- protected Logger log = Logger.getLogger(getClass());
-
- /** The main deployer structure */
- private MainDeployerStructure mainDeployer;
-
- /** The structure cache */
- private StructureCache<T> cache;
-
- protected AbstractStructureModificationChecker(MainDeployerStructure mainDeployer)
- {
- if (mainDeployer == null)
- throw new IllegalArgumentException("Null main deployer");
-
- this.mainDeployer = mainDeployer;
- }
-
- /**
- * Get the structure cache.
- *
- * @return the structure cache
- */
- protected StructureCache<T> getCache()
- {
- if (cache == null)
- cache = new DefaultStructureCache<T>();
-
- return cache;
- }
-
- /**
- * Set the structure cache.
- *
- * @param cache the structure cache
- */
- public void setCache(StructureCache<T> cache)
- {
- this.cache = cache;
- }
-
- /**
- * Get deployment context.
- *
- * @param name the deployment context name
- * @return vfs deployment context or null if doesn't exist or not vfs based
- */
- @SuppressWarnings("deprecation")
- protected VFSDeploymentContext getDeploymentContext(String name)
- {
- DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
- if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
- return null;
-
- return (VFSDeploymentContext) deploymentContext;
- }
-
- public boolean hasStructureBeenModified(VirtualFile root) throws IOException
- {
- if (root == null)
- throw new IllegalArgumentException("Null root");
-
- // skip vfs deployment context lookup if archive or file
- if (root.isArchive() || root.isLeaf())
- return root.hasBeenModified();
-
- VFSDeploymentContext deploymentContext;
- try
- {
- String name = root.toURI().toString();
- deploymentContext = getDeploymentContext(name);
- if (deploymentContext != null)
- return hasStructureBeenModified(deploymentContext, false);
- }
- catch (URISyntaxException ignore)
- {
- }
-
- log.trace("Falling back to root name: " + root);
- deploymentContext = getDeploymentContext(root.getName());
- if (deploymentContext != null)
- return hasStructureBeenModified(deploymentContext, false);
-
- return false;
- }
-
- public boolean hasStructureBeenModified(VFSDeployment deployment) throws IOException
- {
- if (deployment == null)
- throw new IllegalArgumentException("Null deployment");
-
- VFSDeploymentContext deploymentContext = getDeploymentContext(deployment.getName());
- return deploymentContext != null && hasStructureBeenModified(deploymentContext);
- }
-
- public boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext) throws IOException
- {
- return hasStructureBeenModified(deploymentContext, true);
- }
-
- /**
- * Has structure been modified.
- *
- * @param deploymentContext the deployment context
- * @param checkRoot should we check root
- * @return true if modifed, false otherwise
- * @throws IOException for any error
- */
- protected boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext, boolean checkRoot) throws IOException
- {
- Deployment deployment = deploymentContext.getDeployment();
- if (deployment == null || deployment instanceof VFSDeployment == false)
- {
- log.warn("Deployment is not VFS or not top level.");
- return false;
- }
-
- VFSDeployment vfsDeployment = VFSDeployment.class.cast(deployment);
- VirtualFile root = vfsDeployment.getRoot();
- if (checkRoot && (root.isArchive() || root.isLeaf()))
- return root.hasBeenModified();
-
- boolean result = hasStructureBeenModifed(root, deploymentContext);
- if (result)
- {
- String pathName = root.getPathName();
- getCache().invalidateCache(pathName);
- }
- return result;
- }
-
- /**
- * Has structure been modified.
- *
- * @param root the client root
- * @param deploymentContext the deployment context
- * @return true if modifed, false otherwise
- * @throws IOException for any error
- */
- protected abstract boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException;
-
- public void addStructureRoot(VirtualFile root)
- {
- if (root == null)
- throw new IllegalArgumentException("Null root");
-
- String pathName = root.getPathName();
- getCache().initializeCache(pathName);
- }
-
- public void removeStructureRoot(VirtualFile root)
- {
- if (root == null)
- throw new IllegalArgumentException("Null root");
-
- String pathName = root.getPathName();
- getCache().removeCache(pathName);
- }
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,200 @@
+/*
+ * 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.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentContext;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * AbstractStructureModificationChecker.
+ *
+ * @param <T> exact cache value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractStructureModificationChecker<T> implements StructureModificationChecker
+{
+ /** The log */
+ protected Logger log = Logger.getLogger(getClass());
+
+ /** The main deployer structure */
+ private MainDeployerStructure mainDeployer;
+
+ /** The structure cache */
+ private StructureCache<T> cache;
+
+ protected AbstractStructureModificationChecker(MainDeployerStructure mainDeployer)
+ {
+ if (mainDeployer == null)
+ throw new IllegalArgumentException("Null main deployer");
+
+ this.mainDeployer = mainDeployer;
+ }
+
+ /**
+ * Get the structure cache.
+ *
+ * @return the structure cache
+ */
+ protected StructureCache<T> getCache()
+ {
+ if (cache == null)
+ cache = new DefaultStructureCache<T>();
+
+ return cache;
+ }
+
+ /**
+ * Set the structure cache.
+ *
+ * @param cache the structure cache
+ */
+ public void setCache(StructureCache<T> cache)
+ {
+ this.cache = cache;
+ }
+
+ /**
+ * Get deployment context.
+ *
+ * @param name the deployment context name
+ * @return vfs deployment context or null if doesn't exist or not vfs based
+ */
+ @SuppressWarnings("deprecation")
+ protected VFSDeploymentContext getDeploymentContext(String name)
+ {
+ DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
+ if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
+ return null;
+
+ return (VFSDeploymentContext) deploymentContext;
+ }
+
+ public boolean hasStructureBeenModified(VirtualFile root) throws IOException
+ {
+ if (root == null)
+ throw new IllegalArgumentException("Null root");
+
+ // skip vfs deployment context lookup if archive or file
+ if (root.isArchive() || root.isLeaf())
+ return root.hasBeenModified();
+
+ VFSDeploymentContext deploymentContext;
+ try
+ {
+ String name = root.toURI().toString();
+ deploymentContext = getDeploymentContext(name);
+ if (deploymentContext != null)
+ return hasStructureBeenModified(deploymentContext, false);
+ }
+ catch (URISyntaxException ignore)
+ {
+ }
+
+ log.trace("Falling back to root name: " + root);
+ deploymentContext = getDeploymentContext(root.getName());
+ if (deploymentContext != null)
+ return hasStructureBeenModified(deploymentContext, false);
+
+ return false;
+ }
+
+ public boolean hasStructureBeenModified(VFSDeployment deployment) throws IOException
+ {
+ if (deployment == null)
+ throw new IllegalArgumentException("Null deployment");
+
+ VFSDeploymentContext deploymentContext = getDeploymentContext(deployment.getName());
+ return deploymentContext != null && hasStructureBeenModified(deploymentContext);
+ }
+
+ public boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext) throws IOException
+ {
+ return hasStructureBeenModified(deploymentContext, true);
+ }
+
+ /**
+ * Has structure been modified.
+ *
+ * @param deploymentContext the deployment context
+ * @param checkRoot should we check root
+ * @return true if modifed, false otherwise
+ * @throws IOException for any error
+ */
+ protected boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext, boolean checkRoot) throws IOException
+ {
+ Deployment deployment = deploymentContext.getDeployment();
+ if (deployment == null || deployment instanceof VFSDeployment == false)
+ {
+ log.warn("Deployment is not VFS or not top level.");
+ return false;
+ }
+
+ VFSDeployment vfsDeployment = VFSDeployment.class.cast(deployment);
+ VirtualFile root = vfsDeployment.getRoot();
+ if (checkRoot && (root.isArchive() || root.isLeaf()))
+ return root.hasBeenModified();
+
+ boolean result = hasStructureBeenModifed(root, deploymentContext);
+ if (result)
+ {
+ String pathName = root.getPathName();
+ getCache().invalidateCache(pathName);
+ }
+ return result;
+ }
+
+ /**
+ * Has structure been modified.
+ *
+ * @param root the client root
+ * @param deploymentContext the deployment context
+ * @return true if modifed, false otherwise
+ * @throws IOException for any error
+ */
+ protected abstract boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException;
+
+ public void addStructureRoot(VirtualFile root)
+ {
+ if (root == null)
+ throw new IllegalArgumentException("Null root");
+
+ String pathName = root.getPathName();
+ getCache().initializeCache(pathName);
+ }
+
+ public void removeStructureRoot(VirtualFile root)
+ {
+ if (root == null)
+ throw new IllegalArgumentException("Null root");
+
+ String pathName = root.getPathName();
+ getCache().removeCache(pathName);
+ }
+}
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,98 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Pattern;
-
-/**
- * Default structure cache.
- *
- * @param <T> exact cache value type
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class DefaultStructureCache<T> implements StructureCache<T>
-{
- private Map<String, T> map = new ConcurrentHashMap<String, T>();
-
- public void initializeCache(String pathName)
- {
- }
-
- public T putCacheValue(String pathName, T value)
- {
- return map.put(pathName, value);
- }
-
- public T getCacheValue(String pathName)
- {
- return map.get(pathName);
- }
-
- public Set<String> getLeaves(String pathName)
- {
- Set<String> result = null;
- Pattern pattern = Pattern.compile(pathName + "/[^/]+");
- for (String key : map.keySet())
- {
- if (pattern.matcher(key).matches())
- {
- if (result == null)
- result = new HashSet<String>();
-
- result.add(key);
- }
- }
- if (result != null)
- return result;
- else
- return (map.containsKey(pathName) ? Collections.<String>emptySet() : null);
- }
-
- public void invalidateCache(String pathName)
- {
- removeCache(pathName);
- }
-
- public void removeCache(String pathName)
- {
- Iterator<Map.Entry<String, T>> iter = map.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry<String, T> entry = iter.next();
- if (entry.getKey().startsWith(pathName))
- {
- iter.remove();
- }
- }
- }
-
- public void flush()
- {
- map.clear();
- }
-}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/DefaultStructureCache.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,98 @@
+/*
+ * 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.deployers.vfs.spi.structure.modified;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.regex.Pattern;
+
+/**
+ * Default structure cache.
+ *
+ * @param <T> exact cache value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class DefaultStructureCache<T> implements StructureCache<T>
+{
+ private Map<String, T> map = new ConcurrentHashMap<String, T>();
+
+ public void initializeCache(String pathName)
+ {
+ }
+
+ public T putCacheValue(String pathName, T value)
+ {
+ return map.put(pathName, value);
+ }
+
+ public T getCacheValue(String pathName)
+ {
+ return map.get(pathName);
+ }
+
+ public Set<String> getLeaves(String pathName)
+ {
+ Set<String> result = null;
+ Pattern pattern = Pattern.compile(pathName + "/[^/]+");
+ for (String key : map.keySet())
+ {
+ if (pattern.matcher(key).matches())
+ {
+ if (result == null)
+ result = new HashSet<String>();
+
+ result.add(key);
+ }
+ }
+ if (result != null)
+ return result;
+ else
+ return (map.containsKey(pathName) ? Collections.<String>emptySet() : null);
+ }
+
+ public void invalidateCache(String pathName)
+ {
+ removeCache(pathName);
+ }
+
+ public void removeCache(String pathName)
+ {
+ Iterator<Map.Entry<String, T>> iter = map.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ Map.Entry<String, T> entry = iter.next();
+ if (entry.getKey().startsWith(pathName))
+ {
+ iter.remove();
+ }
+ }
+ }
+
+ public void flush()
+ {
+ map.clear();
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,193 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.spi.structure.StructureMetaData;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-
-/**
- * MetaDataStructureModificationChecker.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class MetaDataStructureModificationChecker extends AbstractStructureModificationChecker<Long>
-{
- /** The current context path const */
- private static final Set<String> CURRENT_PATH = Collections.singleton("");
-
- /** The metadata filter */
- private VirtualFileFilter filter;
-
- public MetaDataStructureModificationChecker(MainDeployerStructure mainDeployer)
- {
- super(mainDeployer);
- }
-
- /**
- * Set the metadata filter.
- *
- * @param filter the metadata filter
- */
- public void setFilter(VirtualFileFilter filter)
- {
- this.filter = filter;
- }
-
- protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
- {
- StructureMetaData structureMetaData = deploymentContext.getTransientManagedObjects().getAttachment(StructureMetaData.class);
- return hasStructureBeenModified(root, structureMetaData, null);
- }
-
- /**
- * Has structure been modified.
- *
- * @param root the root
- * @param structureMetaData the structure metadata
- * @param excludedPaths the excluded paths
- * @return true if modifed, false otherwise
- * @throws IOException for any error
- */
- protected boolean hasStructureBeenModified(VirtualFile root, StructureMetaData structureMetaData, Set<String> excludedPaths) throws IOException
- {
- if (structureMetaData == null)
- return false;
-
- List<ContextInfo> contexts = structureMetaData.getContexts();
- if (contexts != null && contexts.isEmpty() == false)
- {
- for (ContextInfo contextInfo : contexts)
- {
- if (excludedPaths != null)
- {
- String path = contextInfo.getPath();
- if (excludedPaths.contains(path))
- {
- continue;
- }
- }
-
- if (hasStructureBeenModifed(root, contextInfo))
- return true;
- }
- }
- return false;
- }
-
- /**
- * Has structure been modifed.
- *
- * @param root the root
- * @param contextInfo the context info
- * @return true if modifed, false otherwise
- * @throws IOException for any error
- */
- protected boolean hasStructureBeenModifed(VirtualFile root, ContextInfo contextInfo) throws IOException
- {
- String path = contextInfo.getPath();
- VirtualFile contextRoot = root.getChild(path);
- if (contextRoot != null)
- {
- List<String> metadataPaths = contextInfo.getMetaDataPath();
- if (metadataPaths != null && metadataPaths.isEmpty() == false)
- {
- for (String metaDataPath : metadataPaths)
- {
- VirtualFile mdpVF = contextRoot.getChild(metaDataPath);
- if (mdpVF != null)
- {
- List<VirtualFile> children = mdpVF.getChildren(filter);
- String mdpPathName = mdpVF.getPathName();
- Set<String> leaves = getCache().getLeaves(mdpPathName);
- // do we have some new files or some were deleted
- if (leaves != null && children != null && leaves.size() != children.size())
- {
- if (log.isTraceEnabled())
- log.trace("Metadata files number changed, old: " + leaves + ", now: " + children);
- return true;
- }
-
- if (children != null && children.isEmpty() == false)
- {
- for (VirtualFile child : children)
- {
- String pathName = child.getPathName();
-
- // we tried to remove non existing leaf - it's new == modified
- if (leaves != null && leaves.remove(pathName) == false)
- {
- if (log.isTraceEnabled())
- log.trace("Found new metadata file: " + child);
- return true;
- }
-
- Long timestamp = getCache().getCacheValue(pathName);
- long lastModified = child.getLastModified();
- if (timestamp != null)
- {
- if (timestamp < lastModified)
- {
- if (log.isTraceEnabled())
- log.trace("Metadata location modified: " + child);
- return true;
- }
- }
- else
- {
- // only put if not modified
- getCache().putCacheValue(pathName, lastModified);
- }
- }
- }
- else
- {
- // mark empty metadata path
- getCache().putCacheValue(mdpPathName, System.currentTimeMillis());
- }
- // not all previous leaves were removed - we're missing some == modified
- if (leaves != null && leaves.isEmpty() == false)
- {
- if (log.isTraceEnabled())
- log.trace("Missing old files: " + leaves);
- return true;
- }
- }
- }
- }
- if ("".equals(path) == false)
- {
- StructureMetaData structureMetaData = contextInfo.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class);
- return hasStructureBeenModified(contextRoot, structureMetaData, CURRENT_PATH);
- }
- }
- return false;
- }
-}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,193 @@
+/*
+ * 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.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * MetaDataStructureModificationChecker.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MetaDataStructureModificationChecker extends AbstractStructureModificationChecker<Long>
+{
+ /** The current context path const */
+ private static final Set<String> CURRENT_PATH = Collections.singleton("");
+
+ /** The metadata filter */
+ private VirtualFileFilter filter;
+
+ public MetaDataStructureModificationChecker(MainDeployerStructure mainDeployer)
+ {
+ super(mainDeployer);
+ }
+
+ /**
+ * Set the metadata filter.
+ *
+ * @param filter the metadata filter
+ */
+ public void setFilter(VirtualFileFilter filter)
+ {
+ this.filter = filter;
+ }
+
+ protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
+ {
+ StructureMetaData structureMetaData = deploymentContext.getTransientManagedObjects().getAttachment(StructureMetaData.class);
+ return hasStructureBeenModified(root, structureMetaData, null);
+ }
+
+ /**
+ * Has structure been modified.
+ *
+ * @param root the root
+ * @param structureMetaData the structure metadata
+ * @param excludedPaths the excluded paths
+ * @return true if modifed, false otherwise
+ * @throws IOException for any error
+ */
+ protected boolean hasStructureBeenModified(VirtualFile root, StructureMetaData structureMetaData, Set<String> excludedPaths) throws IOException
+ {
+ if (structureMetaData == null)
+ return false;
+
+ List<ContextInfo> contexts = structureMetaData.getContexts();
+ if (contexts != null && contexts.isEmpty() == false)
+ {
+ for (ContextInfo contextInfo : contexts)
+ {
+ if (excludedPaths != null)
+ {
+ String path = contextInfo.getPath();
+ if (excludedPaths.contains(path))
+ {
+ continue;
+ }
+ }
+
+ if (hasStructureBeenModifed(root, contextInfo))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Has structure been modifed.
+ *
+ * @param root the root
+ * @param contextInfo the context info
+ * @return true if modifed, false otherwise
+ * @throws IOException for any error
+ */
+ protected boolean hasStructureBeenModifed(VirtualFile root, ContextInfo contextInfo) throws IOException
+ {
+ String path = contextInfo.getPath();
+ VirtualFile contextRoot = root.getChild(path);
+ if (contextRoot != null)
+ {
+ List<String> metadataPaths = contextInfo.getMetaDataPath();
+ if (metadataPaths != null && metadataPaths.isEmpty() == false)
+ {
+ for (String metaDataPath : metadataPaths)
+ {
+ VirtualFile mdpVF = contextRoot.getChild(metaDataPath);
+ if (mdpVF != null)
+ {
+ List<VirtualFile> children = mdpVF.getChildren(filter);
+ String mdpPathName = mdpVF.getPathName();
+ Set<String> leaves = getCache().getLeaves(mdpPathName);
+ // do we have some new files or some were deleted
+ if (leaves != null && children != null && leaves.size() != children.size())
+ {
+ if (log.isTraceEnabled())
+ log.trace("Metadata files number changed, old: " + leaves + ", now: " + children);
+ return true;
+ }
+
+ if (children != null && children.isEmpty() == false)
+ {
+ for (VirtualFile child : children)
+ {
+ String pathName = child.getPathName();
+
+ // we tried to remove non existing leaf - it's new == modified
+ if (leaves != null && leaves.remove(pathName) == false)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Found new metadata file: " + child);
+ return true;
+ }
+
+ Long timestamp = getCache().getCacheValue(pathName);
+ long lastModified = child.getLastModified();
+ if (timestamp != null)
+ {
+ if (timestamp < lastModified)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Metadata location modified: " + child);
+ return true;
+ }
+ }
+ else
+ {
+ // only put if not modified
+ getCache().putCacheValue(pathName, lastModified);
+ }
+ }
+ }
+ else
+ {
+ // mark empty metadata path
+ getCache().putCacheValue(mdpPathName, System.currentTimeMillis());
+ }
+ // not all previous leaves were removed - we're missing some == modified
+ if (leaves != null && leaves.isEmpty() == false)
+ {
+ if (log.isTraceEnabled())
+ log.trace("Missing old files: " + leaves);
+ return true;
+ }
+ }
+ }
+ }
+ if ("".equals(path) == false)
+ {
+ StructureMetaData structureMetaData = contextInfo.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class);
+ return hasStructureBeenModified(contextRoot, structureMetaData, CURRENT_PATH);
+ }
+ }
+ return false;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,88 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import java.util.Set;
-
-/**
- * Simple structure cache.
- *
- * @param <T> exact cache value type
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface StructureCache<T>
-{
- /**
- * Initialize cache.
- *
- * @param pathName the path name
- */
- void initializeCache(String pathName);
-
- /**
- * Put cache value.
- *
- * @param pathName the path name
- * @param value the value
- * @return previous value
- */
- T putCacheValue(String pathName, T value);
-
- /**
- * Get cache value.
- *
- * @param pathName the path name
- * @return the cache value
- */
- T getCacheValue(String pathName);
-
- /**
- * Get leaves for this path name parameter.
- * Only exact sub path nodes count in.
- *
- * This method should return a mutable Set copy
- * as we intend to modify it in checker processing.
- *
- * @param pathName the path name
- * @return sub-paths nodes or null if no such match yet
- */
- Set<String> getLeaves(String pathName);
-
- /**
- * Invalidate cache for path name.
- *
- * @param pathName the path name
- */
- void invalidateCache(String pathName);
-
- /**
- * Remove cache for path name.
- *
- * @param pathName the path name
- */
- void removeCache(String pathName);
-
- /**
- * Flush the cache.
- */
- void flush();
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureCache.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,88 @@
+/*
+ * 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.deployers.vfs.spi.structure.modified;
+
+import java.util.Set;
+
+/**
+ * Simple structure cache.
+ *
+ * @param <T> exact cache value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface StructureCache<T>
+{
+ /**
+ * Initialize cache.
+ *
+ * @param pathName the path name
+ */
+ void initializeCache(String pathName);
+
+ /**
+ * Put cache value.
+ *
+ * @param pathName the path name
+ * @param value the value
+ * @return previous value
+ */
+ T putCacheValue(String pathName, T value);
+
+ /**
+ * Get cache value.
+ *
+ * @param pathName the path name
+ * @return the cache value
+ */
+ T getCacheValue(String pathName);
+
+ /**
+ * Get leaves for this path name parameter.
+ * Only exact sub path nodes count in.
+ *
+ * This method should return a mutable Set copy
+ * as we intend to modify it in checker processing.
+ *
+ * @param pathName the path name
+ * @return sub-paths nodes or null if no such match yet
+ */
+ Set<String> getLeaves(String pathName);
+
+ /**
+ * Invalidate cache for path name.
+ *
+ * @param pathName the path name
+ */
+ void invalidateCache(String pathName);
+
+ /**
+ * Remove cache for path name.
+ *
+ * @param pathName the path name
+ */
+ void removeCache(String pathName);
+
+ /**
+ * Flush the cache.
+ */
+ void flush();
+}
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,46 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import org.jboss.virtual.VirtualFile;
-
-/**
- * StructureListener.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface StructureListener
-{
- /**
- * Add structure root.
- *
- * @param root the structure root
- */
- void addStructureRoot(VirtualFile root);
-
- /**
- * Remove structure root.
- *
- * @param root the structure root
- */
- void removeStructureRoot(VirtualFile root);
-}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureListener.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,46 @@
+/*
+ * 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.deployers.vfs.spi.structure.modified;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * StructureListener.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface StructureListener
+{
+ /**
+ * Add structure root.
+ *
+ * @param root the structure root
+ */
+ void addStructureRoot(VirtualFile root);
+
+ /**
+ * Remove structure root.
+ *
+ * @param root the structure root
+ */
+ void removeStructureRoot(VirtualFile root);
+}
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,63 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import java.io.IOException;
-
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * Simple structure modification checker interface.
- *
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public interface StructureModificationChecker extends StructureListener
-{
- /**
- * Has structure been modified.
- *
- * @param root the structure's root
- * @return true if structure has been modified, false otherwise
- * @throws IOException for any error
- */
- boolean hasStructureBeenModified(VirtualFile root) throws IOException;
-
- /**
- * Has structure been modified.
- *
- * @param deployment the vfs deployment
- * @return true if structure has been modified, false otherwise
- * @throws IOException for any error
- */
- boolean hasStructureBeenModified(VFSDeployment deployment) throws IOException;
-
- /**
- * Has structure been modified.
- *
- * @param deploymentContext the vfs deployment context
- * @return true if structure has been modified, false otherwise
- * @throws IOException for any error
- */
- boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext) throws IOException;
-}
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/StructureModificationChecker.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -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.deployers.vfs.spi.structure.modified;
+
+import java.io.IOException;
+
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Simple structure modification checker interface.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface StructureModificationChecker extends StructureListener
+{
+ /**
+ * Has structure been modified.
+ *
+ * @param root the structure's root
+ * @return true if structure has been modified, false otherwise
+ * @throws IOException for any error
+ */
+ boolean hasStructureBeenModified(VirtualFile root) throws IOException;
+
+ /**
+ * Has structure been modified.
+ *
+ * @param deployment the vfs deployment
+ * @return true if structure has been modified, false otherwise
+ * @throws IOException for any error
+ */
+ boolean hasStructureBeenModified(VFSDeployment deployment) throws IOException;
+
+ /**
+ * Has structure been modified.
+ *
+ * @param deploymentContext the vfs deployment context
+ * @return true if structure has been modified, false otherwise
+ * @throws IOException for any error
+ */
+ boolean hasStructureBeenModified(VFSDeploymentContext deploymentContext) throws IOException;
+}
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -1,351 +0,0 @@
-/*
- * 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.deployers.vfs.spi.structure.modified;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-
-import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
-
-/**
- * Tree base structure cache.
- *
- * @param <T> exact value type
- * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
- */
-public class TreeStructureCache<T> implements StructureCache<T>
-{
- /** The tree root */
- private final Node<T> root = createRoot();
-
- /**
- * Create new root.
- *
- * @return the new root
- */
- protected Node<T> createRoot()
- {
- return new Node<T>("", getDefaultValue(), null);
- }
-
- /**
- * Get default node value.
- *
- * @return the default node value
- */
- protected T getDefaultValue()
- {
- return null;
- }
-
- public void initializeCache(String pathName)
- {
- initializeNode(pathName);
- }
-
- public T putCacheValue(String pathName, T value)
- {
- Node<T> node = getNode(pathName);
- if (node == null)
- node = initializeNode(pathName);
-
- T previous = node.getValue();
- node.setValue(value);
- return previous;
- }
-
- public T getCacheValue(String pathName)
- {
- Node<T> node = getNode(pathName);
- return (node != null ? node.getValue() : null);
- }
-
- public Set<String> getLeaves(String pathName)
- {
- Node<T> node = getNode(pathName);
- return (node != null) ? node.getChildrenNames() : null;
- }
-
- public void invalidateCache(String pathName)
- {
- removeCache(pathName);
- }
-
- public void removeCache(String pathName)
- {
- Node<T> node = getNode(pathName);
- if (node != null)
- {
- Node<T> parent = node.getParent();
- if (parent != null)
- parent.removeChild(node);
- else // clear root
- flush();
- }
- }
-
- public void flush()
- {
- synchronized (root)
- {
- root.clear();
- }
- }
-
- /**
- * Get the path's node.
- *
- * @param path the path
- * @return node or null if it doesn't exist
- */
- protected Node<T> getNode(String path)
- {
- List<String> tokens = PathTokenizer.getTokens(path);
- synchronized (root)
- {
- Node<T> node = root;
- for (String token : tokens)
- {
- node = node.getChild(token);
- if (node == null)
- break;
- }
- return node;
- }
- }
-
- /**
- * Initialize node for pathName param.
- *
- * @param pathName the path name
- * @return initialized node
- */
- protected Node<T> initializeNode(String pathName)
- {
- List<String> tokens = PathTokenizer.getTokens(pathName);
- synchronized (root)
- {
- Node<T> node = root;
- boolean newNode = false;
- for (String token : tokens)
- {
- if (newNode)
- {
- node = new Node<T>(token, getDefaultValue(), node);
- }
- else
- {
- Node<T> child = node.getChild(token);
- if (child == null)
- {
- child = new Node<T>(token, getDefaultValue(), node);
- newNode = true;
- }
-
- node = child;
- }
- }
- return node;
- }
- }
-
- /**
- * Simple node impl.
- *
- * @param <U> the exact value type
- */
- private class Node<U>
- {
- private String name;
- private String fullName;
- private Node<U> parent;
-
- private U value;
- private Map<String, Node<U>> children;
- private Set<String> names;
-
- private Node(String name, U value, Node<U> parent)
- {
- this.name = name;
- this.value = value;
- this.parent = parent;
- if (parent != null)
- parent.addChild(this);
- }
-
- /**
- * The node name.
- *
- * @return the node name
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Get full name.
- *
- * @return the full name
- */
- public String getFullName()
- {
- if (fullName == null)
- {
- Node<U> parent = getParent();
- if (parent != null && parent.getParent() != null)
- {
- fullName = parent.getFullName() + "/" + getName();
- }
- else
- {
- fullName = getName();
- }
- }
- return fullName;
- }
-
- /**
- * Get node value.
- *
- * @return the node value
- */
- public U getValue()
- {
- return value;
- }
-
- /**
- * Set the node value.
- *
- * @param value the value
- */
- public void setValue(U value)
- {
- this.value = value;
- }
-
- /**
- * Get parent node.
- *
- * @return the parent node
- */
- public Node<U> getParent()
- {
- return parent;
- }
-
- /**
- * Add child.
- *
- * @param node the child node
- */
- private void addChild(Node<U> node)
- {
- if (children == null)
- children = new HashMap<String, Node<U>>();
-
- children.put(node.getName(), node);
-
- if (names != null)
- names.add(node.getFullName());
- }
-
- /**
- * Remove child.
- *
- * @param node the child node
- */
- public synchronized void removeChild(Node<U> node)
- {
- if (children == null)
- return;
-
- children.remove(node.getName());
-
- if (names != null)
- names.remove(node.getFullName());
-
- if (children.isEmpty())
- children = null;
- if (names != null && names.isEmpty())
- names = null;
- }
-
- /**
- * Clear node.
- */
- void clear()
- {
- value = null;
- children = null;
- names = null;
- }
-
- /**
- * Get child.
- *
- * @param name the child name
- * @return child node or null if not found
- */
- public Node<U> getChild(String name)
- {
- return (children != null) ? children.get(name) : null;
- }
-
- /**
- * Get children names.
- *
- * @return the children names
- */
- public synchronized Set<String> getChildrenNames()
- {
- if (children == null)
- return Collections.emptySet();
-
- if (names == null)
- {
- names = new HashSet<String>();
- for (Node<U> child : children.values())
- {
- names.add(child.getFullName());
- }
- }
- return names;
- }
-
- /**
- * Get children.
- *
- * @return the children
- */
- public Collection<Node<U>> getChildren()
- {
- return (children != null) ? children.values() : Collections.<Node<U>>emptySet();
- }
- }
-}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java (from rev 84533, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/TreeStructureCache.java 2009-02-20 14:46:04 UTC (rev 84534)
@@ -0,0 +1,351 @@
+/*
+ * 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.deployers.vfs.spi.structure.modified;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
+
+/**
+ * Tree base structure cache.
+ *
+ * @param <T> exact value type
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class TreeStructureCache<T> implements StructureCache<T>
+{
+ /** The tree root */
+ private final Node<T> root = createRoot();
+
+ /**
+ * Create new root.
+ *
+ * @return the new root
+ */
+ protected Node<T> createRoot()
+ {
+ return new Node<T>("", getDefaultValue(), null);
+ }
+
+ /**
+ * Get default node value.
+ *
+ * @return the default node value
+ */
+ protected T getDefaultValue()
+ {
+ return null;
+ }
+
+ public void initializeCache(String pathName)
+ {
+ initializeNode(pathName);
+ }
+
+ public T putCacheValue(String pathName, T value)
+ {
+ Node<T> node = getNode(pathName);
+ if (node == null)
+ node = initializeNode(pathName);
+
+ T previous = node.getValue();
+ node.setValue(value);
+ return previous;
+ }
+
+ public T getCacheValue(String pathName)
+ {
+ Node<T> node = getNode(pathName);
+ return (node != null ? node.getValue() : null);
+ }
+
+ public Set<String> getLeaves(String pathName)
+ {
+ Node<T> node = getNode(pathName);
+ return (node != null) ? node.getChildrenNames() : null;
+ }
+
+ public void invalidateCache(String pathName)
+ {
+ removeCache(pathName);
+ }
+
+ public void removeCache(String pathName)
+ {
+ Node<T> node = getNode(pathName);
+ if (node != null)
+ {
+ Node<T> parent = node.getParent();
+ if (parent != null)
+ parent.removeChild(node);
+ else // clear root
+ flush();
+ }
+ }
+
+ public void flush()
+ {
+ synchronized (root)
+ {
+ root.clear();
+ }
+ }
+
+ /**
+ * Get the path's node.
+ *
+ * @param path the path
+ * @return node or null if it doesn't exist
+ */
+ protected Node<T> getNode(String path)
+ {
+ List<String> tokens = PathTokenizer.getTokens(path);
+ synchronized (root)
+ {
+ Node<T> node = root;
+ for (String token : tokens)
+ {
+ node = node.getChild(token);
+ if (node == null)
+ break;
+ }
+ return node;
+ }
+ }
+
+ /**
+ * Initialize node for pathName param.
+ *
+ * @param pathName the path name
+ * @return initialized node
+ */
+ protected Node<T> initializeNode(String pathName)
+ {
+ List<String> tokens = PathTokenizer.getTokens(pathName);
+ synchronized (root)
+ {
+ Node<T> node = root;
+ boolean newNode = false;
+ for (String token : tokens)
+ {
+ if (newNode)
+ {
+ node = new Node<T>(token, getDefaultValue(), node);
+ }
+ else
+ {
+ Node<T> child = node.getChild(token);
+ if (child == null)
+ {
+ child = new Node<T>(token, getDefaultValue(), node);
+ newNode = true;
+ }
+
+ node = child;
+ }
+ }
+ return node;
+ }
+ }
+
+ /**
+ * Simple node impl.
+ *
+ * @param <U> the exact value type
+ */
+ private class Node<U>
+ {
+ private String name;
+ private String fullName;
+ private Node<U> parent;
+
+ private U value;
+ private Map<String, Node<U>> children;
+ private Set<String> names;
+
+ private Node(String name, U value, Node<U> parent)
+ {
+ this.name = name;
+ this.value = value;
+ this.parent = parent;
+ if (parent != null)
+ parent.addChild(this);
+ }
+
+ /**
+ * The node name.
+ *
+ * @return the node name
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get full name.
+ *
+ * @return the full name
+ */
+ public String getFullName()
+ {
+ if (fullName == null)
+ {
+ Node<U> parent = getParent();
+ if (parent != null && parent.getParent() != null)
+ {
+ fullName = parent.getFullName() + "/" + getName();
+ }
+ else
+ {
+ fullName = getName();
+ }
+ }
+ return fullName;
+ }
+
+ /**
+ * Get node value.
+ *
+ * @return the node value
+ */
+ public U getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Set the node value.
+ *
+ * @param value the value
+ */
+ public void setValue(U value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * Get parent node.
+ *
+ * @return the parent node
+ */
+ public Node<U> getParent()
+ {
+ return parent;
+ }
+
+ /**
+ * Add child.
+ *
+ * @param node the child node
+ */
+ private void addChild(Node<U> node)
+ {
+ if (children == null)
+ children = new HashMap<String, Node<U>>();
+
+ children.put(node.getName(), node);
+
+ if (names != null)
+ names.add(node.getFullName());
+ }
+
+ /**
+ * Remove child.
+ *
+ * @param node the child node
+ */
+ public synchronized void removeChild(Node<U> node)
+ {
+ if (children == null)
+ return;
+
+ children.remove(node.getName());
+
+ if (names != null)
+ names.remove(node.getFullName());
+
+ if (children.isEmpty())
+ children = null;
+ if (names != null && names.isEmpty())
+ names = null;
+ }
+
+ /**
+ * Clear node.
+ */
+ void clear()
+ {
+ value = null;
+ children = null;
+ names = null;
+ }
+
+ /**
+ * Get child.
+ *
+ * @param name the child name
+ * @return child node or null if not found
+ */
+ public Node<U> getChild(String name)
+ {
+ return (children != null) ? children.get(name) : null;
+ }
+
+ /**
+ * Get children names.
+ *
+ * @return the children names
+ */
+ public synchronized Set<String> getChildrenNames()
+ {
+ if (children == null)
+ return Collections.emptySet();
+
+ if (names == null)
+ {
+ names = new HashSet<String>();
+ for (Node<U> child : children.values())
+ {
+ names.add(child.getFullName());
+ }
+ }
+ return names;
+ }
+
+ /**
+ * Get children.
+ *
+ * @return the children
+ */
+ public Collection<Node<U>> getChildren()
+ {
+ return (children != null) ? children.values() : Collections.<Node<U>>emptySet();
+ }
+ }
+}
Modified: projects/jboss-deployers/branches/Branch_2_0/pom.xml
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/pom.xml 2009-02-20 14:19:29 UTC (rev 84533)
+++ projects/jboss-deployers/branches/Branch_2_0/pom.xml 2009-02-20 14:46:04 UTC (rev 84534)
@@ -21,11 +21,11 @@
</scm>
<properties>
- <version.jboss.vfs>2.0.1.GA</version.jboss.vfs>
+ <version.jboss.vfs>2.1.0.GA</version.jboss.vfs>
<version.jboss.man>2.0.0.GA</version.jboss.man>
<version.jboss.mdr>2.0.1.GA</version.jboss.mdr>
- <version.jboss.microcontainer>2.0.3.GA</version.jboss.microcontainer>
- <version.jboss.classloader>2.0.2.GA</version.jboss.classloader>
+ <version.jboss.microcontainer>2.0.4.GA</version.jboss.microcontainer>
+ <version.jboss.classloader>2.0.3.GA</version.jboss.classloader>
<version.jboss.classloading.spi>5.0.3.GA</version.jboss.classloading.spi>
<version.jboss.common.core>2.2.10.GA</version.jboss.common.core>
<version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
More information about the jboss-cvs-commits
mailing list