[jboss-cvs] JBossAS SVN: r87597 - in projects/jboss-deployers/branches/Branch_2_0: build and 39 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 20 17:20:29 EDT 2009
Author: alesj
Date: 2009-04-20 17:20:27 -0400 (Mon, 20 Apr 2009)
New Revision: 87597
Added:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaHelper.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractSynchAdapter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeOverrideSynchAdapter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeSynchAdapter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/OverrideSynchAdapter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchAdapter.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchVisitor.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/MarkedAnnotation.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EarTempStructure.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/WarTempStructure.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml
Removed:
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployerHelper.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml
Modified:
projects/jboss-deployers/branches/Branch_2_0/
projects/jboss-deployers/branches/Branch_2_0/build/
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/managed/support/TestFields.java
projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java
projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java
projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnit.java
projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java
projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXBDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXPDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleJBossXBDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleObjectModelFactoryDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/ObjectModelFactoryDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SecurityActions.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/UnmarshallerFactoryDeployer.java
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/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTestDelegate.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/Marked.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AbstractAnnotationsScanningUnitTest.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/ManagedObjectClassLoadingParserUnitTestCase.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.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/ear/support/MockEarStructureDeployer.java
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/annotations/basic-scan/META-INF/jboss-scanning.xml
projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/bootstrap/bootstrap.xml
projects/jboss-deployers/branches/Branch_2_0/pom.xml
Log:
Merge with trunk.
Property changes on: projects/jboss-deployers/branches/Branch_2_0
___________________________________________________________________
Name: svn:ignore
- jboss-deployers-aggregator.iws
jboss-deployers-aggregator.ipr
*.iml
log.txt
.classpath
.project
+ jboss-deployers-aggregator.iws
jboss-deployers-aggregator.ipr
*.iml
log.txt
.classpath
.project
jboss-deployers-parent.iws
jboss-deployers-parent.iml
jboss-deployers-parent.ipr
Property changes on: projects/jboss-deployers/branches/Branch_2_0/build
___________________________________________________________________
Name: svn:ignore
- jboss-deployers.iml
target
+ jboss-deployers.iml
target
jboss-deployers-dist.iml
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-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/main/java/org/jboss/deployers/plugins/main/MainDeployerImpl.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -106,7 +106,7 @@
private Comparator<DeploymentContext> reverted;
/** The re-deployments */
- private Map<String, Deployment> toRedeploy = Collections.synchronizedMap(new LinkedHashMap<String, Deployment>());
+ private final Map<String, Deployment> toRedeploy = Collections.synchronizedMap(new LinkedHashMap<String, Deployment>());
/**
* Set the top deployment context comparator.
@@ -647,8 +647,12 @@
if (shutdown.get())
throw new IllegalStateException("The main deployer is shutdown");
- Map<String, Deployment> copy = new LinkedHashMap<String, Deployment>(toRedeploy);
- toRedeploy.clear();
+ Map<String, Deployment> copy = new LinkedHashMap<String, Deployment>();
+ synchronized (toRedeploy)
+ {
+ copy.putAll(toRedeploy);
+ toRedeploy.clear();
+ }
try
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/support/TestFields.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/support/TestFields.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/support/TestFields.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -25,7 +25,7 @@
/**
* TestFields.
- *
+ *
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
@@ -35,9 +35,9 @@
private static final long serialVersionUID = 1L;
private TestAttachment attachment;
-
+
private String property;
-
+
public TestFields(TestAttachment attachment, String property)
{
this.attachment = attachment;
@@ -60,6 +60,15 @@
attachment.setProperty(property, value);
return;
}
- throw new UnsupportedOperationException("setField: " + name);
+ else if (name != Fields.MODIFIED)
+ {
+ throw new UnsupportedOperationException("setField: " + name);
+ }
}
+
+
+ public Fields copy()
+ {
+ return new TestFields(attachment.clone(), property);
+ }
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-impl/src/test/java/org/jboss/test/deployers/managed/test/DeployerManagedDeploymentUnitTestCase.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -60,7 +60,7 @@
/**
* ManagedDeployment unit tests.
- *
+ *
* @author Scott.Stark at jboss.org
* @author Ales.Justin at jboss.org
* @version $Revision$
@@ -68,7 +68,7 @@
public class DeployerManagedDeploymentUnitTestCase extends AbstractManagedObjectUnitTest
{
private MCFDeployer deployer = new MCFDeployer();
-
+
public static Test suite()
{
return new TestSuite(DeployerManagedDeploymentUnitTestCase.class);
@@ -170,7 +170,7 @@
ManagedProperty targetProp = mc.getProperty("jndi-name");
assertNotNull(targetProp);
targetProp.setValue(getMetaValueFactory().create("java:DefaultDS2"));
- // test target runtime component invocation (if intendet here)
+ // test target runtime component invocation (if intendet here)
}
public void testManagedDeployment() throws Exception
@@ -180,7 +180,7 @@
ManagedObjectFactory mof = ManagedObjectFactory.getInstance();
TestServiceMetaDataICF tsicf = new TestServiceMetaDataICF();
mof.setInstanceClassFactory(TestServiceMetaData.class, tsicf);
-
+
// Deploy a datasource with local and xa factories
Deployment ctx1 = createSimpleDeployment("deployment1");
DSMetaData dsmd = new DSMetaData();
@@ -310,7 +310,7 @@
// Validate that the sec-domain1 ManagedObject is the target of the localSecDomainRefProp
log.info("sec-domain1 ManagedObjectNames: "+ secMD1.getManagedObjectNames());
ManagedObject sd1MO = secMD1.getManagedObject("java:/jaas/domain1");
-
+
assertNotNull("java:/jaas/domain1 MO", sd1MO);
ManagedObject localSecDomainPropTarget = localSecDomainRefProp.getTargetManagedObject();
assertEquals(sd1MO, localSecDomainPropTarget);
@@ -328,7 +328,7 @@
ManagedOperation closePool = null;
ManagedOperation takesString = null;
ManagedOperation constrainedIntx10 = null;
-
+
for(ManagedOperation op : localDataOps)
{
if (op.getName().equals("flushPool"))
@@ -339,7 +339,7 @@
takesString = op;
if (op.getName().equals("constrainedIntx10"))
constrainedIntx10 = op;
-
+
}
// flushPool
assertNotNull("flushPool found", flushPool);
@@ -371,21 +371,21 @@
assertEquals("constrainedIntx10", constrainedIntx10.getName());
assertEquals("Takes an int and multiples by 10", constrainedIntx10.getDescription());
assertEquals(ManagedOperation.Impact.ReadOnly, constrainedIntx10.getImpact());
- assertEquals(SimpleMetaType.INTEGER, constrainedIntx10.getReturnType());
+ assertEquals(SimpleMetaType.INTEGER_PRIMITIVE, constrainedIntx10.getReturnType());
ManagedParameter[] constrainedIntx10Params = constrainedIntx10.getParameters();
assertEquals("one params", 1, constrainedIntx10Params.length);
assertEquals("param name", "input", constrainedIntx10Params[0].getName());
assertEquals("param description", "The int to multiple", constrainedIntx10Params[0].getDescription());
- assertEquals("param type", SimpleMetaType.INTEGER, constrainedIntx10Params[0].getMetaType());
+ assertEquals("param type", SimpleMetaType.INTEGER_PRIMITIVE, constrainedIntx10Params[0].getMetaType());
Object min = constrainedIntx10Params[0].getMinimumValue();
assertEquals("param min is 0", 0, (MetaValue)min);
assertEquals("param min is 100", 100, (MetaValue)constrainedIntx10Params[0].getMaximumValue());
-
+
// Validate that the localDataMO includes the runtime properties
ManagedProperty rtp1 = localDataProps.get("runtimeProp1");
assertNotNull("runtimeProp1", rtp1);
ManagedProperty rtp2 = localDataProps.get("runtimeProp2");
- assertNotNull("runtimeProp2", rtp2);
+ assertNotNull("runtimeProp2", rtp2);
}
protected DeployerClient getMainDeployer()
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-spi/src/main/java/org/jboss/deployers/spi/deployer/helpers/AbstractParsingDeployerWithOutput.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -49,6 +49,9 @@
/** The jar extension */
private String jarExtension;
+ /** The attachment key */
+ private String attachmentKey;
+
/** Include the deployment file */
private boolean includeDeploymentFile = false;
@@ -66,6 +69,7 @@
if (output == null)
throw new IllegalArgumentException("Null output");
setOutput(output);
+ setAttachmentKey(output.getName());
}
@SuppressWarnings("unchecked")
@@ -98,10 +102,10 @@
*/
public void setName(String name)
{
- if (names != null)
- throw new IllegalArgumentException("Names already set.");
-
- this.names = Collections.singleton(name);
+ if (name != null)
+ names = Collections.singleton(name);
+ else
+ names = null;
}
/**
@@ -255,8 +259,29 @@
{
return unit.getAttachment(key, getOutput());
}
-
+
/**
+ * Get attachment key.
+ * By default it's output's fqn classname.
+ *
+ * @return the attachment key.
+ */
+ protected String getAttachmentKey()
+ {
+ return attachmentKey;
+ }
+
+ /**
+ * Set attachment key.
+ *
+ * @param attachmentKey the attachment key
+ */
+ public void setAttachmentKey(String attachmentKey)
+ {
+ this.attachmentKey = attachmentKey;
+ }
+
+ /**
* Create some meta data. Calls createMetaData(unit, name, suffix, getDeploymentType().getName()).
*
* @param unit the deployment unit
@@ -266,7 +291,7 @@
*/
protected void createMetaData(DeploymentUnit unit, String name, String suffix) throws DeploymentException
{
- createMetaData(unit, name, suffix, getOutput().getName());
+ createMetaData(unit, name, suffix, getAttachmentKey());
}
/**
@@ -279,7 +304,7 @@
*/
protected void createMetaData(DeploymentUnit unit, Set<String> names, String suffix) throws DeploymentException
{
- createMetaData(unit, names, suffix, getOutput().getName());
+ createMetaData(unit, names, suffix, getAttachmentKey());
}
/**
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentContext.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -29,6 +29,7 @@
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.attachments.ManagedObjectsWithTransientAttachments;
import org.jboss.metadata.spi.MetaData;
import org.jboss.metadata.spi.MutableMetaData;
@@ -39,6 +40,7 @@
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 59630 $
*/
public interface DeploymentContext extends ManagedObjectsWithTransientAttachments
@@ -339,6 +341,20 @@
ClassLoader getResourceClassLoader();
/**
+ * Get underlying controller context name.
+ *
+ * @return the controller context name
+ */
+ Object getControllerContextName();
+
+ /**
+ * Set the required stage.
+ *
+ * @param stage the required stage
+ */
+ void setRequiredStage(DeploymentStage stage);
+
+ /**
* Get the dependency info
*
* @return the dependency
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnit.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnit.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/DeploymentUnit.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -29,6 +29,7 @@
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.metadata.spi.MetaData;
import org.jboss.metadata.spi.MutableMetaData;
import org.jboss.metadata.spi.scope.ScopeKey;
@@ -41,6 +42,7 @@
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public interface DeploymentUnit extends MutableAttachments
@@ -259,8 +261,22 @@
* @return the deployer or null if not associated with a main deployer
*/
MainDeployer getMainDeployer();
-
+
/**
+ * Get underlying controller context name.
+ *
+ * @return the controller context name
+ */
+ Object getControllerContextName();
+
+ /**
+ * Set the required stage.
+ *
+ * @param stage the required stage
+ */
+ void setRequiredStage(DeploymentStage stage);
+
+ /**
* Get the dependency info
*
* @return the dependency
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentContext.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -44,9 +44,11 @@
import org.jboss.classloading.spi.RealClassLoader;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.DependencyInfo;
+import org.jboss.dependency.spi.ControllerState;
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.attachments.Attachments;
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.attachments.helpers.ManagedObjectsWithTransientAttachmentsImpl;
@@ -72,6 +74,7 @@
*
* @author <a href="adrian at jboss.org">Adrian Brock</a>
* @author Scott.Stark at jboss.org
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class AbstractDeploymentContext extends ManagedObjectsWithTransientAttachmentsImpl implements DeploymentContext, AbstractDeploymentContextMBean, MBeanRegistration
@@ -752,16 +755,53 @@
return EmptyResourceLoader.INSTANCE;
}
+ public Object getControllerContextName()
+ {
+ ControllerContext controllerContext = getTransientAttachments().getAttachment(ControllerContext.class);
+ if (controllerContext != null)
+ {
+ return controllerContext.getName();
+ }
+ else
+ {
+ DeploymentContext parent = getParent();
+ if (parent == null)
+ throw new IllegalStateException("Deployment ControllerContext has not been set");
+
+ return parent.getControllerContextName();
+ }
+ }
+
+ public void setRequiredStage(DeploymentStage stage)
+ {
+ ControllerContext controllerContext = getTransientAttachments().getAttachment(ControllerContext.class);
+ if (controllerContext != null)
+ {
+ controllerContext.setRequiredState(new ControllerState(stage.getName()));
+ }
+ else
+ {
+ DeploymentContext parent = getParent();
+ if (parent == null)
+ throw new IllegalStateException("Deployment ControllerContext has not been set");
+
+ parent.setRequiredStage(stage);
+ }
+ }
+
public DependencyInfo getDependencyInfo()
{
ControllerContext controllerContext = getTransientAttachments().getAttachment(ControllerContext.class);
if (controllerContext != null)
+ {
return controllerContext.getDependencyInfo();
+ }
else
{
DeploymentContext parent = getParent();
if (parent == null)
throw new IllegalStateException("Deployment ControllerContext has not been set");
+
return parent.getDependencyInfo();
}
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/AbstractDeploymentUnit.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -36,6 +36,7 @@
import org.jboss.dependency.spi.DependencyItem;
import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.attachments.helpers.AbstractMutableAttachments;
import org.jboss.deployers.structure.spi.ClassLoaderFactory;
@@ -55,6 +56,7 @@
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class AbstractDeploymentUnit extends AbstractMutableAttachments implements DeploymentUnit
@@ -461,6 +463,16 @@
getDeploymentContext().visit(contextVisitor);
}
+ public Object getControllerContextName()
+ {
+ return getDeploymentContext().getControllerContextName();
+ }
+
+ public void setRequiredStage(DeploymentStage stage)
+ {
+ getDeploymentContext().setRequiredStage(stage);
+ }
+
public DependencyInfo getDependencyInfo()
{
return getDeploymentContext().getDependencyInfo();
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-structure-spi/src/main/java/org/jboss/deployers/structure/spi/helpers/ComponentDeploymentContext.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -40,6 +40,7 @@
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.DeploymentState;
+import org.jboss.deployers.spi.deployer.DeploymentStage;
import org.jboss.deployers.spi.attachments.Attachments;
import org.jboss.deployers.spi.attachments.AttachmentsFactory;
import org.jboss.deployers.spi.attachments.MutableAttachments;
@@ -60,6 +61,7 @@
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 59630 $
*/
public class ComponentDeploymentContext implements DeploymentContext, ComponentDeploymentContextMBean, MBeanRegistration
@@ -422,6 +424,16 @@
return parent.getResourceLoader();
}
+ public Object getControllerContextName()
+ {
+ return parent.getControllerContextName();
+ }
+
+ public void setRequiredStage(DeploymentStage stage)
+ {
+ parent.setRequiredStage(stage);
+ }
+
public DependencyInfo getDependencyInfo()
{
return parent.getDependencyInfo();
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -87,6 +87,7 @@
try
{
VirtualFile parentFile = vfsParent.getRoot();
+ @SuppressWarnings("deprecation")
VirtualFile file = parentFile.findChild(path); // leaving the findChild usage
return new AbstractVFSDeploymentContext(applyModification(file, child), path);
}
@@ -141,6 +142,7 @@
return modified;
}
+ @SuppressWarnings("deprecation")
protected void applyContextInfo(DeploymentContext context, ContextInfo contextInfo) throws Exception
{
super.applyContextInfo(context, contextInfo);
@@ -172,7 +174,9 @@
String suffixes = entry.getSuffixes();
VirtualFile child;
if (entry.getPath().length() == 0)
+ {
child = root;
+ }
else
{
try
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTest.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -25,6 +25,7 @@
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.List;
+import java.io.IOException;
import junit.framework.AssertionFailedError;
@@ -89,7 +90,7 @@
return (BootstrapDeployersTestDelegate) super.getDelegate();
}
- protected VFSDeployment createVFSDeployment(String root, String child) throws Exception
+ protected VirtualFile createDeploymentRoot(String root, String child) throws IOException
{
URL resourceRoot = getClass().getResource(root);
if (resourceRoot == null)
@@ -97,9 +98,15 @@
VirtualFile deployment = VFS.getVirtualFile(resourceRoot, child);
if (deployment == null)
fail("Child not found " + child + " from " + resourceRoot);
+ return deployment;
+ }
+
+ protected VFSDeployment createVFSDeployment(String root, String child) throws Exception
+ {
+ VirtualFile deployment = createDeploymentRoot(root, child);
return createVFSDeployment(deployment);
}
-
+
protected VFSDeployment createVFSDeployment(VirtualFile root) throws Exception
{
VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTestDelegate.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTestDelegate.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/BootstrapDeployersTestDelegate.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -22,7 +22,6 @@
package org.jboss.test.deployers;
import java.net.URL;
-
import javax.management.MBeanServer;
import javax.management.ObjectName;
@@ -38,7 +37,7 @@
import org.jboss.deployers.plugins.main.MainDeployerImpl;
import org.jboss.deployers.spi.deployer.Deployers;
import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.resolver.MutableSchemaResolver;
import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
/**
@@ -57,9 +56,9 @@
static
{
- DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
- resolver.addClassBinding("urn:jboss:classloader:1.0", VFSClassLoaderFactory10.class);
- resolver.addClassBinding("urn:jboss:classloading:1.0", ClassLoadingMetaData10.class);
+ MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+ resolver.mapURIToClass("urn:jboss:classloader:1.0", VFSClassLoaderFactory10.class);
+ resolver.mapURIToClass("urn:jboss:classloading:1.0", ClassLoadingMetaData10.class);
// TODO add a negating class filter to jboss-classloader
ClassFilter classFilter = new ClassFilter()
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/Marked.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/Marked.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/Marked.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -21,13 +21,17 @@
*/
package org.jboss.test.deployers.vfs.annotations.support;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
+import java.lang.annotation.RetentionPolicy;
/**
* @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
*/
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD})
+ at Retention(RetentionPolicy.RUNTIME)
+ at MarkedAnnotation
public @interface Marked
{
}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/MarkedAnnotation.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/MarkedAnnotation.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/MarkedAnnotation.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/support/MarkedAnnotation.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,36 @@
+/*
+* 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.annotations.support;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+ at Target({ElementType.ANNOTATION_TYPE})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface MarkedAnnotation
+{
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AbstractAnnotationsScanningUnitTest.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AbstractAnnotationsScanningUnitTest.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/AbstractAnnotationsScanningUnitTest.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -26,6 +26,7 @@
import org.jboss.deployers.spi.annotations.AnnotationEnvironment;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.test.deployers.vfs.annotations.support.NoExtRecurseFilter;
import org.jboss.test.deployers.vfs.annotations.support.ext.External;
import org.jboss.test.deployers.vfs.annotations.support.jar.JarMarkOnClass;
import org.jboss.test.deployers.vfs.annotations.support.jar.impl.JarMarkOnClassImpl;
@@ -70,6 +71,12 @@
assertEar(unit);
try
{
+ AnnotationEnvironment env = unit.getAttachment(AnnotationEnvironment.class);
+ assertNotNull(env);
+ Set annotations = env.classIsAnnotatedWith("org.jboss.test.deployers.vfs.annotations.support.MarkedAnnotation");
+ assertNotNull(annotations);
+ assertEquals(1, annotations.size());
+
DeploymentUnit jarUnit = assertChild(unit, "simple.jar");
assertJar(jarUnit);
DeploymentUnit webUnit = assertChild(unit, "simple.war");
@@ -113,6 +120,8 @@
addPackage(util, Util.class);
AssembledDirectory ext = earLib.mkdir("ext.jar");
addPackage(ext, External.class);
+ AssembledDirectory ann = earLib.mkdir("ann.jar");
+ addPackage(ann, NoExtRecurseFilter.class);
return topLevel;
}
}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/ManagedObjectClassLoadingParserUnitTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/ManagedObjectClassLoadingParserUnitTestCase.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/classloader/test/ManagedObjectClassLoadingParserUnitTestCase.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -44,7 +44,7 @@
/**
* ManagedObjectClassLoadingParserUnitTestCase.
- *
+ *
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @version $Revision: 1.1 $
*/
@@ -62,7 +62,7 @@
{
super(name);
}
-
+
protected ManagedProperty assertManagedProperty(ManagedObject mo, String name, MetaType metaType, MetaValue metaValue)
{
ManagedProperty property = mo.getProperty(name);
@@ -71,7 +71,7 @@
assertEquals(metaValue, property.getValue());
return property;
}
-
+
protected <T> ManagedProperty assertManagedProperty(ManagedObject mo, String name, Class<T> type, T value)
{
MetaType metaType = mtFactory.resolve(type);
@@ -114,11 +114,11 @@
assertManagedProperty(mo, "included", String.class, null);
assertManagedProperty(mo, "excluded", String.class, null);
assertManagedProperty(mo, "excludedExport", String.class, null);
- assertManagedProperty(mo, "importAll", Boolean.class, false);
- assertManagedProperty(mo, "parentFirst", Boolean.class, true);
+ assertManagedProperty(mo, "importAll", boolean.class, false);
+ assertManagedProperty(mo, "parentFirst", boolean.class, true);
assertManagedProperty(mo, "capabilities", CapabilitiesMetaData.class, new CapabilitiesMetaData());
assertManagedProperty(mo, "requirements", RequirementsMetaData.class, new RequirementsMetaData());
-
+
}
finally
{
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/JBossRarMetaData.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -23,6 +23,7 @@
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
import org.jboss.xb.annotations.JBossXmlSchema;
@@ -31,6 +32,7 @@
*/
@JBossXmlSchema(namespace="http://jboss.org/xml/ns/j2ee", elementFormDefault=XmlNsForm.QUALIFIED)
@XmlRootElement(name="jboss-connector")
+ at XmlType(propOrder = {"description", "element"})
public class JBossRarMetaData extends ConnectorMetaData
{
public static final long serialVersionUID = 1l;
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/merge/support/RarMetaData.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -23,6 +23,7 @@
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
import org.jboss.xb.annotations.JBossXmlSchema;
@@ -31,6 +32,7 @@
*/
@JBossXmlSchema(namespace="http://java.sun.com/xml/ns/j2ee", elementFormDefault=XmlNsForm.QUALIFIED)
@XmlRootElement(name="connector")
+ at XmlType(propOrder = {"description", "element"})
public class RarMetaData extends ConnectorMetaData
{
public static final long serialVersionUID = 1l;
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/DeployersValidateInputTestCase.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -22,6 +22,8 @@
package org.jboss.test.deployers.vfs.deployer.validate.test;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import junit.framework.Test;
import org.jboss.deployers.spi.DeploymentException;
@@ -36,6 +38,7 @@
import org.jboss.test.deployers.vfs.deployer.validate.support.MyVirtualFile;
import org.jboss.test.deployers.vfs.deployer.validate.support.TestXmlDeployer;
import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.binding.JBossXBException;
/**
* Validate deployers.
@@ -60,20 +63,17 @@
TestXmlDeployer xmlDeployer = new TestXmlDeployer();
xmlDeployer.create();
- AbstractVFSParsingDeployer<?>[] deployers = new AbstractVFSParsingDeployer<?>[]
- {
- new Properties2BeansDeployer(),
- new MockBshDeployer(),
-// new TestJaxbDeployer(),
- xmlDeployer,
- new SchemaResolverDeployer<Object>(Object.class),
- };
+ Map<AbstractVFSParsingDeployer<?>, Class<? extends Exception>> map = new HashMap<AbstractVFSParsingDeployer<?>, Class<? extends Exception>>();
+ map.put(new Properties2BeansDeployer(), IOException.class);
+ map.put(new MockBshDeployer(), IOException.class);
+ map.put(xmlDeployer, RuntimeException.class);
+ map.put(new SchemaResolverDeployer<Object>(Object.class), JBossXBException.class);
VirtualFile root = new MyVirtualFile();
AbstractVFSDeploymentContext context = new MyVFSDeploymentContext(root, "");
DeploymentUnit unit = context.getDeploymentUnit();
- for(AbstractVFSParsingDeployer<?> deployer : deployers)
+ for(AbstractVFSParsingDeployer<?> deployer : map.keySet())
{
// set name to "" to match in deployment
deployer.setName("");
@@ -85,7 +85,11 @@
catch(Exception e)
{
assertInstanceOf(e, DeploymentException.class);
- assertInstanceOf(e.getCause(), IOException.class);
+ Throwable cause = e.getCause();
+ if (map.get(deployer).isInstance(cause) == false)
+ {
+ fail("Illegal exception cause: " + cause);
+ }
}
}
}
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-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/VFSStructureTestSuite.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -44,6 +44,7 @@
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;
+import org.jboss.test.deployers.vfs.structure.modified.test.SynchModificationTestCase;
/**
* VFSStructureTestSuite.
@@ -83,6 +84,7 @@
suite.addTest(DirStructureUnitTestCase.suite());
suite.addTest(RealDirStructureUnitTestCase.suite());
suite.addTest(MetaDataStructureModificationTestCase.suite());
+ suite.addTest(SynchModificationTestCase.suite());
return suite;
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/ear/support/MockEarStructureDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -126,7 +126,7 @@
{
List<VirtualFile> archives = lib.getChildren(earLibFilter);
for (VirtualFile archive : archives)
- super.addClassPath(structureContext, archive, true, true, context);
+ addClassPath(structureContext, archive, true, true, context);
}
}
catch (IOException ignored)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EarTempStructure.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EarTempStructure.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EarTempStructure.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/EarTempStructure.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,41 @@
+/*
+ * 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.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.ModificationType;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer;
+
+/**
+ * Temping ear.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class EarTempStructure extends MockEarStructureDeployer
+{
+ protected void applyContextInfo(StructureContext context, ContextInfo result)
+ {
+ super.applyContextInfo(context, result);
+ result.setModificationType(ModificationType.TEMP);
+ }
+}
\ 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/WarTempStructure.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/WarTempStructure.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/WarTempStructure.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/support/WarTempStructure.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,41 @@
+/*
+ * 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.deployers.vfs.plugins.structure.war.WARStructure;
+import org.jboss.deployers.vfs.spi.structure.StructureContext;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.ModificationType;
+
+/**
+ * Temping war.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class WarTempStructure extends WARStructure
+{
+ protected void applyContextInfo(StructureContext context, ContextInfo result)
+ {
+ super.applyContextInfo(context, result);
+ result.setModificationType(ModificationType.TEMP);
+ }
+}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/AbstractSynchTest.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -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.MetaDataStructureModificationChecker;
+import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
+import org.jboss.deployers.vfs.spi.structure.modified.SynchAdapter;
+import org.jboss.deployers.vfs.spi.structure.modified.SynchWrapperModificationChecker;
+import org.jboss.test.deployers.BootstrapDeployersTest;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * AbstractSynchTest.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractSynchTest extends BootstrapDeployersTest
+{
+ protected AbstractSynchTest(String name)
+ {
+ super(name);
+ }
+
+ protected StructureModificationChecker createStructureModificationChecker()
+ {
+ MainDeployerStructure mainDeployerStructure = getMainDeployerStructure();
+ VirtualFileFilter filter = createFilter();
+ VirtualFileFilter recurseFilter = createRecurseFilter();
+ SynchAdapter synchAdapter = createSynchAdapter();
+
+ MetaDataStructureModificationChecker mdsmc = new MetaDataStructureModificationChecker(mainDeployerStructure);
+ mdsmc.setFilter(filter);
+ SynchWrapperModificationChecker synch = new SynchWrapperModificationChecker(mdsmc, synchAdapter);
+
+ VisitorAttributes attributes = new VisitorAttributes();
+ attributes.setLeavesOnly(true);
+ attributes.setRecurseFilter(recurseFilter);
+
+ synch.setOriginalAttributes(attributes);
+ synch.setTempAttributes(attributes);
+
+ return synch;
+ }
+
+ protected abstract VirtualFileFilter createFilter();
+
+ protected abstract VirtualFileFilter createRecurseFilter();
+
+ protected abstract SynchAdapter createSynchAdapter();
+}
\ No newline at end of file
Modified: 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/MetaDataStructureModificationTestCase.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -155,9 +155,9 @@
assertFalse(checker.hasStructureBeenModified(root));
File f1 = new File(url1.toURI());
- assertTrue(f1.setLastModified(System.currentTimeMillis()));
+ assertTrue(f1.setLastModified(System.currentTimeMillis() + 1500l));
File f2 = new File(url2.toURI());
- assertTrue(f2.setLastModified(System.currentTimeMillis()));
+ assertTrue(f2.setLastModified(System.currentTimeMillis() + 1500l));
assertTrue(checker.hasStructureBeenModified(root));
assertFalse(checker.hasStructureBeenModified(root));
Modified: 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/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/StructureModificationTest.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -42,7 +42,7 @@
protected StructureModificationChecker createStructureModificationChecker()
{
- MainDeployerStructure mainDeployer = assertBean("MainDeployer", MainDeployerStructure.class);
+ MainDeployerStructure mainDeployer = getMainDeployerStructure();
VirtualFileFilter filter = createFilter();
return createStructureModificationChecker(mainDeployer, filter);
}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,186 @@
+/*
+ * 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.io.IOException;
+import java.io.FileOutputStream;
+import java.io.BufferedWriter;
+import java.io.OutputStreamWriter;
+import java.net.URI;
+
+import junit.framework.Test;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.modified.OverrideSynchAdapter;
+import org.jboss.deployers.vfs.spi.structure.modified.StructureModificationChecker;
+import org.jboss.deployers.vfs.spi.structure.modified.SynchAdapter;
+import org.jboss.test.deployers.vfs.structure.modified.support.XmlIncludeVirtualFileFilter;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VFSUtils;
+
+/**
+ * Test file synch.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SynchModificationTestCase extends AbstractSynchTest
+{
+ public SynchModificationTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return suite(SynchModificationTestCase.class);
+ }
+
+ protected VirtualFileFilter createFilter()
+ {
+ return new XmlIncludeVirtualFileFilter();
+ }
+
+ protected VirtualFileFilter createRecurseFilter()
+ {
+ return new VirtualFileFilter()
+ {
+ public boolean accepts(VirtualFile file)
+ {
+ String path = file.getPathName();
+ // only wars, but not its classes
+ return (path.contains(".war") && path.contains("/WEB-INF") == false);
+ }
+ };
+ }
+
+ protected SynchAdapter createSynchAdapter()
+ {
+ return new OverrideSynchAdapter();
+ }
+
+ public void testWAR() throws Exception
+ {
+ VirtualFile originalRoot = createDeploymentRoot("/synch/war", "simple.war");
+ VFSDeploymentUnit deploymentUnit = assertDeploy(originalRoot);
+ try
+ {
+ VirtualFile tempRoot = deploymentUnit.getRoot();
+ StructureModificationChecker checker = createStructureModificationChecker();
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+
+ // add new file
+ URI rootURI = VFSUtils.getRealURL(originalRoot).toURI();
+ File rootFile = new File(rootURI);
+ File newFile = newFile(rootFile, "newfile.txt");
+ try
+ {
+ assertNull(tempRoot.getChild("newfile.txt"));
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ assertNotNull(tempRoot.getChild("newfile.txt"));
+
+ // try deleting this one now
+ assertTrue(newFile.delete());
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ assertNull(tempRoot.getChild("newfile.txt"));
+ }
+ finally
+ {
+ if (newFile.exists())
+ assertTrue(newFile.delete());
+ }
+
+ // update some file
+ File updateFile = new File(rootFile, "test.jsp");
+ assertTrue(updateFile.exists());
+ assertTrue(updateFile.setLastModified(System.currentTimeMillis() + 1500l));
+ @SuppressWarnings("deprecation")
+ VirtualFile testJsp = tempRoot.findChild("test.jsp");
+ long tempTimestamp = testJsp.getLastModified();
+ // Platform dependent precision for last modified, let's wait a minimum of 1 sec
+ Thread.sleep(1500l);
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ long lastModified = testJsp.getLastModified();
+ long diff = lastModified - tempTimestamp;
+ assertTrue("Last modified diff is not bigger then 0, diff: " + diff, diff > 0);
+
+ // update something outside recurse filter
+ VirtualFile someProps = originalRoot.getChild("WEB-INF/classes/some.properties");
+ assertNotNull(someProps);
+ updateFile = new File(VFSUtils.getRealURL(someProps).toURI());
+ assertTrue(updateFile.exists());
+ assertTrue(updateFile.setLastModified(System.currentTimeMillis() + 1500l));
+ @SuppressWarnings("deprecation")
+ VirtualFile tempProps = tempRoot.findChild("WEB-INF/classes/some.properties");
+ tempTimestamp = tempProps.getLastModified();
+ // Platform dependent precision for last modified, let's wait a minimum of 1 sec
+ Thread.sleep(1500l);
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ assertEquals(tempTimestamp, tempProps.getLastModified());
+
+ // check we don't update for nothing
+ @SuppressWarnings("deprecation")
+ VirtualFile xhtml = tempRoot.findChild("test.xhtml");
+ long xhtmlTimestamp = xhtml.getLastModified();
+ // Platform dependent precision for last modified, let's wait a minimum of 1 sec
+ Thread.sleep(1500l);
+ assertFalse(checker.hasStructureBeenModified(originalRoot));
+ assertEquals(xhtmlTimestamp, xhtml.getLastModified());
+
+ }
+ finally
+ {
+ undeploy(deploymentUnit);
+ }
+ }
+
+ public void testEAR() throws Exception
+ {
+ VFSDeploymentUnit deploymentUnit = assertDeploy("/synch/ear", "simple.ear");
+ try
+ {
+ VirtualFile root = deploymentUnit.getRoot();
+ StructureModificationChecker checker = createStructureModificationChecker();
+ assertFalse(checker.hasStructureBeenModified(root));
+ }
+ finally
+ {
+ undeploy(deploymentUnit);
+ }
+ }
+
+ protected File newFile(File parent, String name) throws IOException
+ {
+ File newFile = new File(parent, name);
+ FileOutputStream fos = new FileOutputStream(newFile);
+ BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos));
+ try
+ {
+ writer.write("sometext");
+ return newFile;
+ }
+ finally
+ {
+ writer.close();
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/annotations/basic-scan/META-INF/jboss-scanning.xml
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/annotations/basic-scan/META-INF/jboss-scanning.xml 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/annotations/basic-scan/META-INF/jboss-scanning.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -2,4 +2,7 @@
<path name="lib/util.jar">
<include name="org.jboss.test.deployers.vfs.annotations.support.util"/>
</path>
+ <path name="lib/ann.jar">
+ <include name="org.jboss.test.deployers.vfs.annotations.support"/>
+ </path>
</scanning>
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/bootstrap/bootstrap.xml
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/bootstrap/bootstrap.xml 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/bootstrap/bootstrap.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -36,10 +36,10 @@
<!-- The holder for deployers that do real deployment -->
<bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
<constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+ <property name="mgtObjectCreator"><inject bean="ManagedObjectCreator"/></property>
<!-- Accept any implementor of deployer -->
<incallback method="addDeployer"/>
<uncallback method="removeDeployer"/>
- <property name="mgtObjectCreator"><inject bean="ManagedObjectCreator"/></property>
</bean>
<!-- A declared structure descriptor deployer -->
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1,6 +0,0 @@
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
- <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
-
-</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/MetaDataStructureModificationTestCase.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,6 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.ear.support.MockEarStructureDeployer"/>
+ <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.war.support.MockWarStructureDeployer"/>
+
+</deployment>
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1,6 +0,0 @@
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.modified.support.EarTempStructure"/>
- <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.modified.support.WarTempStructure"/>
-
-</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/org/jboss/test/deployers/vfs/structure/modified/test/SynchModificationTestCase.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,6 @@
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EarStructure" class="org.jboss.test.deployers.vfs.structure.modified.support.EarTempStructure"/>
+ <bean name="WarStructure" class="org.jboss.test.deployers.vfs.structure.modified.support.WarTempStructure"/>
+
+</deployment>
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1,2 +0,0 @@
-jar-module=ejb.jar
-web-module=ui.war
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/META-INF/application.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,2 @@
+jar-module=ejb.jar
+web-module=ui.war
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-<ejb/>
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/META-INF/ejb-jar.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+<ejb/>
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-test=123
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ejb.jar/some.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+test=123
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-test=123
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/classes/some.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+test=123
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-<web/>
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/WEB-INF/web.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+<web/>
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-Some jsp.
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.jsp 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+Some jsp.
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-<html/>
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/ear/simple.ear/ui.war/test.xhtml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+<html/>
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF)
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-test=123
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/classes/some.properties 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+test=123
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-<web/>
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/WEB-INF/web.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+<web/>
\ No newline at end of file
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-Some jsp.
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.jsp 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+Some jsp.
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml 2009-04-20 19:57:26 UTC (rev 87594)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1 +0,0 @@
-<html/>
\ No newline at end of file
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs/src/test/resources/synch/war/simple.war/test.xhtml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1 @@
+<html/>
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXBDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXBDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXBDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -21,45 +21,58 @@
*/
package org.jboss.deployers.vfs.spi.deployer;
-import java.io.InputStream;
import java.util.Map;
-
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.bind.helpers.DefaultValidationEventHandler;
+import javax.xml.validation.Schema;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VFSInputSource;
import org.jboss.virtual.VirtualFile;
import org.xml.sax.InputSource;
/**
* JAXBDeployer.
- *
- * @param <T> the expected type
+ *
+ * @param <T> the expected type
* @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public abstract class JAXBDeployer<T> extends AbstractVFSParsingDeployer<T>
{
- /** The JAXBContext */
+ /** The JAXBContext */
private JAXBContext context;
/** The properties */
private Map<String, Object> properties;
-
+
+ /** The classes to be bound */
+ private Class<?>[] classesToBeBound;
+
+ /** The schema location */
+ private String schemaLocation;
+
+ /** The validation event handler */
+ private ValidationEventHandler validationEventHandler = new DefaultValidationEventHandler();
+
/**
* Create a new JAXBDeployer.
- *
+ *
* @param output the output
* @throws IllegalArgumentException for a null output
*/
public JAXBDeployer(Class<T> output)
{
super(output);
+ classesToBeBound = new Class<?>[]{output};
}
/**
* Get the properties.
- *
+ *
* @return the properties.
*/
public Map<String, Object> getProperties()
@@ -69,7 +82,7 @@
/**
* Set the properties.
- *
+ *
* @param properties the properties.
*/
public void setProperties(Map<String, Object> properties)
@@ -78,47 +91,93 @@
}
/**
+ * Set the classes to be bound.
+ *
+ * @param classesToBeBound the classes to be bouond
+ */
+ public void setClassesToBeBound(Class<?>... classesToBeBound)
+ {
+ this.classesToBeBound = classesToBeBound;
+ }
+
+ /**
+ * Set schema location.
+ *
+ * @param schemaLocation the schema location
+ */
+ public void setSchemaLocation(String schemaLocation)
+ {
+ this.schemaLocation = schemaLocation;
+ }
+
+ /**
+ * Set the validation event handler.
+ *
+ * @param validationEventHandler the validation event handler
+ */
+ public void setValidationEventHandler(ValidationEventHandler validationEventHandler)
+ {
+ this.validationEventHandler = validationEventHandler;
+ }
+
+ /**
* Create lifecycle
- *
+ *
* @throws Exception for any problem
*/
public void create() throws Exception
{
+ context = createContext();
+ }
+
+ /**
+ * Create context.
+ *
+ * @return new context instance
+ * @throws Exception for any error
+ */
+ protected JAXBContext createContext() throws Exception
+ {
if (properties != null)
- context = JAXBContext.newInstance(new Class[] { getOutput() }, properties);
+ return JAXBContext.newInstance(classesToBeBound(), properties);
else
- context = JAXBContext.newInstance(getOutput());
+ return JAXBContext.newInstance(classesToBeBound());
}
/**
+ * Get classes to be bound.
+ *
+ * @return the classes to be bound
+ */
+ protected Class<?>[] classesToBeBound()
+ {
+ return classesToBeBound;
+ }
+
+ /**
* Destroy lifecycle
*/
public void destroy()
{
context = null;
}
-
+
@Override
protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception
{
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+
+ log.debug("Parsing: " + file.getName());
+
Unmarshaller unmarshaller = context.createUnmarshaller();
- InputStream is = openStreamAndValidate(file);
- try
- {
- InputSource source = new InputSource(is);
- source.setSystemId(file.toURI().toString());
- Object o = unmarshaller.unmarshal(source);
- return getOutput().cast(o);
- }
- finally
- {
- try
- {
- is.close();
- }
- catch (Exception ignored)
- {
- }
- }
+ unmarshaller.setEventHandler(validationEventHandler);
+ Schema schema = SchemaHelper.getSchema(schemaLocation);
+ if (schema != null)
+ unmarshaller.setSchema(schema);
+
+ InputSource source = new VFSInputSource(file);
+ Object result = unmarshaller.unmarshal(source);
+ return getOutput().cast(result);
}
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXPDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXPDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JAXPDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -21,13 +21,13 @@
*/
package org.jboss.deployers.vfs.spi.deployer;
-import java.io.InputStream;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.virtual.VFSInputSource;
import org.jboss.virtual.VirtualFile;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@@ -55,7 +55,10 @@
/** The document builder factory */
private DocumentBuilderFactory documentBuilderFactory;
-
+
+ /** The schema location */
+ private String schemaLocation;
+
/**
* Create a new JAXPDeployer.
*
@@ -108,6 +111,16 @@
}
/**
+ * Set schema location.
+ *
+ * @param schemaLocation the schema location
+ */
+ public void setSchemaLocation(String schemaLocation)
+ {
+ this.schemaLocation = schemaLocation;
+ }
+
+ /**
* Get the documentBuilderFactory.
*
* @return the documentBuilderFactory.
@@ -117,6 +130,7 @@
{
if (documentBuilderFactory == null)
throw new IllegalStateException("Document builder factory has not been constructed");
+
return documentBuilderFactory;
}
@@ -130,6 +144,11 @@
documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(useNamespaceAwareParser);
documentBuilderFactory.setValidating(validateDTDs);
+ Schema schema = SchemaHelper.getSchema(schemaLocation);
+ if (schema != null)
+ {
+ documentBuilderFactory.setSchema(schema);
+ }
}
/**
@@ -186,25 +205,11 @@
log.debug("Parsing: " + file.getName());
- DocumentBuilder parser = getDocumentBuilderFactory().newDocumentBuilder();
- InputStream is = openStreamAndValidate(file);
- try
- {
- InputSource source = new InputSource(is);
- source.setSystemId(file.toURI().toString());
- parser.setEntityResolver(new JBossEntityResolver());
- return parser.parse(source);
- }
- finally
- {
- try
- {
- is.close();
- }
- catch (Exception ignored)
- {
- }
- }
+ InputSource source = new VFSInputSource(file);
+ DocumentBuilderFactory factory = getDocumentBuilderFactory();
+ DocumentBuilder parser = factory.newDocumentBuilder();
+ parser.setEntityResolver(new JBossEntityResolver());
+ return parser.parse(source);
}
/**
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -21,6 +21,8 @@
*/
package org.jboss.deployers.vfs.spi.deployer;
+import org.jboss.xb.util.JBossXBHelper;
+
/**
* JBoss XB deployer.
*
@@ -30,7 +32,7 @@
public abstract class JBossXBDeployer<T> extends UnmarshallerFactoryDeployer<T, Boolean>
{
/** The helper */
- private JBossXBDeployerHelper<T> helper;
+ private JBossXBHelper<T> helper;
/**
* Create a new SchemaResolverDeployer.
@@ -41,7 +43,7 @@
public JBossXBDeployer(Class<T> output)
{
super(output);
- this.helper = new JBossXBDeployerHelper<T>(output);
+ this.helper = new JBossXBHelper<T>(output);
}
/**
@@ -49,14 +51,20 @@
*
* @return the helper
*/
- protected JBossXBDeployerHelper<T> getHelper()
+ protected JBossXBHelper<T> getHelper()
{
return helper;
}
protected UnmarshallerFactory<Boolean> createUnmarshallerFactory()
{
- return getHelper();
+ return new UnmarshallerFactory<Boolean>()
+ {
+ public void setFeature(String featureName, Boolean flag) throws Exception
+ {
+ getHelper().setFeature(featureName, flag);
+ }
+ };
}
protected Boolean fromString(String value)
Deleted: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployerHelper.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployerHelper.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/JBossXBDeployerHelper.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -1,296 +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.deployers.vfs.spi.deployer;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.logging.Logger;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.xb.annotations.JBossXmlSchema;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-import org.xml.sax.InputSource;
-
-/**
- * JBossXB deployer helper.
- *
- * @param <T> the expected type
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
- */
-public class JBossXBDeployerHelper<T> implements org.jboss.deployers.vfs.spi.deployer.UnmarshallerFactory<Boolean>
-{
- /** The log */
- private Logger log = Logger.getLogger(JBossXBDeployerHelper.class);
-
- /** Unmarshaller factory */
- private static final UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
-
- /** The singleton schema resolver */
- private static DefaultSchemaResolver resolver = (DefaultSchemaResolver)SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
-
- /** The output */
- private Class<T> output;
-
- /** Whether the Unmarshaller will use schema validation */
- private boolean useSchemaValidation = true;
-
- /** Whether to validate */
- private boolean useValidation = true;
-
- /**
- * Create a new SchemaResolverDeployer.
- *
- * @param output the output
- * @throws IllegalArgumentException for a null output
- */
- protected JBossXBDeployerHelper(Class<T> output)
- {
- if (output == null)
- throw new IllegalArgumentException("Null output.");
- this.output = output;
- }
-
- public void setFeature(String featureName, Boolean flag) throws Exception
- {
- factory.setFeature(featureName, flag);
- }
-
- /**
- * Get the useSchemaValidation.
- *
- * @return the useSchemaValidation.
- */
- public boolean isUseSchemaValidation()
- {
- return useSchemaValidation;
- }
-
- /**
- * Set the useSchemaValidation.
- *
- * @param useSchemaValidation the useSchemaValidation.
- */
- public void setUseSchemaValidation(boolean useSchemaValidation)
- {
- this.useSchemaValidation = useSchemaValidation;
- }
-
- /**
- * Get the useValidation.
- *
- * @return the useValidation.
- */
- public boolean isUseValidation()
- {
- return useValidation;
- }
-
- /**
- * Set the useValidation.
- *
- * @param useValidation the useValidation.
- */
- public void setUseValidation(boolean useValidation)
- {
- this.useValidation = useValidation;
- }
-
- /**
- * Add class binding.
- *
- * @param namespace the namespace
- * @param metadata the metadata
- */
- public static void addClassBinding(String namespace, Class<?> metadata)
- {
- resolver.addClassBinding(namespace, metadata);
- }
-
- /**
- * Remove class binding.
- *
- * @param namespace the namespace
- */
- public static void removeClassBinding(String namespace)
- {
- resolver.removeClassBinding(namespace);
- }
-
- /**
- * Find the namespace on class/package
- *
- * @param metadata the metadata class
- * @return jboss xml schema namespace
- */
- public static String findNamespace(Class<?> metadata)
- {
- JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class);
- if (jBossXmlSchema == null)
- {
- Package pckg = metadata.getPackage();
- if (pckg != null)
- jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class);
- }
- return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null;
- }
-
- /**
- * Parse file to output metadata.
- *
- * @param file the file to parse
- * @return new metadata instance
- * @throws Exception for any error
- */
- public T parse(VirtualFile file) throws Exception
- {
- return parse(output, file);
- }
-
- /**
- * Parse the file to create metadata instance.
- *
- * @param <U> the expect type
- * @param expectedType the expected type
- * @param file the file
- * @return new metadata instance
- * @throws Exception for any error
- */
- public <U> U parse(Class<U> expectedType, VirtualFile file) throws Exception
- {
- if (expectedType == null)
- throw new IllegalArgumentException("Null expected type");
- if (file == null)
- throw new IllegalArgumentException("Null file");
-
- log.debug("Parsing file: "+file+" for type: " + expectedType);
- Unmarshaller unmarshaller = factory.newUnmarshaller();
- unmarshaller.setSchemaValidation(isUseSchemaValidation());
- unmarshaller.setValidation(isUseValidation());
- InputStream is = openStreamAndValidate(file);
- Object parsed;
- try
- {
- InputSource source = new InputSource(is);
- source.setSystemId(file.toURI().toString());
- parsed = unmarshaller.unmarshal(source, resolver);
- }
- finally
- {
- try
- {
- is.close();
- }
- catch (Exception ignored)
- {
- }
- }
- if (parsed == null)
- throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!");
-
- log.debug("Parsed file: "+file+" to: "+parsed);
- return expectedType.cast(parsed);
- }
-
- /**
- * Parse the file using object model factory.
- *
- * @param file the file to parse
- * @param root the previous root
- * @param omf the object model factory
- * @return new metadata instance
- * @throws Exception for any error
- */
- public T parse(VirtualFile file, T root, ObjectModelFactory omf) throws Exception
- {
- return parse(output, file, root, omf);
- }
-
- /**
- * Parse the file using object model factory.
- *
- * @param <U> the expect type
- * @param expectedType the expected type
- * @param file the file to parse
- * @param root the previous root
- * @param omf the object model factory
- * @return new metadata instance
- * @throws Exception for any error
- */
- public <U> U parse(Class<U> expectedType, VirtualFile file, U root, ObjectModelFactory omf) throws Exception
- {
- if (file == null)
- throw new IllegalArgumentException("Null file");
-
- log.debug("Parsing file: "+file+" for deploymentType: " + expectedType);
-
- Unmarshaller unmarshaller = factory.newUnmarshaller();
- unmarshaller.setSchemaValidation(isUseSchemaValidation());
- unmarshaller.setValidation(isUseValidation());
- InputStream is = openStreamAndValidate(file);
- Object parsed;
- try
- {
- InputSource source = new InputSource(is);
- source.setSystemId(file.toURI().toString());
- parsed = unmarshaller.unmarshal(source, omf, root);
- }
- finally
- {
- try
- {
- is.close();
- }
- catch (Exception ignored)
- {
- }
- }
- if (parsed == null)
- throw new DeploymentException("The xml " + file.getPathName() + " is not well formed!");
-
- log.debug("Parsed file: "+file+" to: "+parsed);
- return expectedType.cast(parsed);
- }
-
- /**
- * Open stream and validate if not null.
- *
- * @param file the virtual file
- * @return non-null input stream
- * @throws Exception for any error or if file's stream is null
- */
- protected static InputStream openStreamAndValidate(VirtualFile file) throws Exception
- {
- if (file == null)
- throw new IllegalArgumentException("Null file");
-
- InputStream inputStream = SecurityActions.openStream(file);
- if (inputStream == null)
- throw new IOException("Null file stream: " + file);
-
- return inputStream;
- }
-}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleJBossXBDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleJBossXBDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleJBossXBDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -23,6 +23,8 @@
import java.util.Map;
+import org.jboss.xb.util.JBossXBHelper;
+
/**
* MultipleJBossXBDeployer.
*
@@ -32,7 +34,7 @@
public abstract class MultipleJBossXBDeployer<T> extends MultipleVFSParsingDeployer<T>
{
/** The helper */
- private JBossXBDeployerHelper<T> helper;
+ private JBossXBHelper<T> helper;
/** The features */
private Map<String, Boolean> features;
@@ -45,7 +47,7 @@
public MultipleJBossXBDeployer(Class<T> output, Map<String, Class<?>> mappings, String suffix, Class<?> suffixClass)
{
super(output, mappings, suffix, suffixClass);
- this.helper = new JBossXBDeployerHelper<T>(output);
+ this.helper = new JBossXBHelper<T>(output);
}
/**
@@ -53,7 +55,7 @@
*
* @return the helper
*/
- protected JBossXBDeployerHelper<T> getHelper()
+ protected JBossXBHelper<T> getHelper()
{
return helper;
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleObjectModelFactoryDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleObjectModelFactoryDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleObjectModelFactoryDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -24,7 +24,9 @@
import java.util.Map;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSInputSource;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.xml.sax.InputSource;
/**
* MultipleObjectModelFactoryDeployer.
@@ -55,8 +57,9 @@
ObjectModelFactory objectModelFactory = getObjectModelFactory(expectedType, file, tRoot);
if (objectModelFactory == null)
log.warn("ObjectModelFactory factory is null, expectedType=" + expectedType + ", file=" + file);
-
- return getHelper().parse(expectedType, file, tRoot, objectModelFactory);
+
+ InputSource source = new VFSInputSource(file);
+ return getHelper().parse(expectedType, source, tRoot, objectModelFactory);
}
/**
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/MultipleSchemaResolverDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -26,8 +26,11 @@
import java.util.Map;
import java.util.Set;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSInputSource;
import org.jboss.xb.annotations.JBossXmlConstants;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.util.JBossXBHelper;
+import org.xml.sax.InputSource;
/**
* MultipleSchemaResolverDeployer.
@@ -82,14 +85,14 @@
{
if (excluded.contains(metadata) == false)
{
- String namespace = JBossXBDeployerHelper.findNamespace(metadata);
+ String namespace = JBossXBHelper.findNamespace(metadata);
if (namespace == null || JBossXmlConstants.DEFAULT.equals(namespace))
throw new IllegalArgumentException(
"Registering schema with JBossXB is enabled, but cannot find namespace on class or package: " + metadata +
", perhaps missing @JBossXmlSchema or using default namespace attribute."
);
- JBossXBDeployerHelper.addClassBinding(namespace, metadata);
+ JBossXBHelper.addClassBinding(namespace, metadata);
namespaces.add(namespace);
}
}
@@ -100,12 +103,13 @@
public void destroy()
{
for (String namespace : namespaces)
- JBossXBDeployerHelper.removeClassBinding(namespace);
+ JBossXBHelper.removeClassBinding(namespace);
namespaces.clear();
}
protected <U> U parse(Class<U> expectedType, VirtualFile file, Object root) throws Exception
{
- return getHelper().parse(expectedType, file);
+ InputSource source = new VFSInputSource(file);
+ return getHelper().parse(expectedType, source);
}
}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/ObjectModelFactoryDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/ObjectModelFactoryDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/ObjectModelFactoryDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -23,7 +23,9 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSInputSource;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.xml.sax.InputSource;
/**
* ObjectModelFactoryDeployer extends the AbstractParsingDeployer to add an
@@ -53,7 +55,8 @@
@Override
protected T parse(VFSDeploymentUnit unit, VirtualFile file, T root) throws Exception
{
- return getHelper().parse(file, root, getObjectModelFactory(root));
+ InputSource source = new VFSInputSource(file);
+ return getHelper().parse(source, root, getObjectModelFactory(root));
}
/**
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaHelper.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaHelper.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaHelper.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaHelper.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,58 @@
+/*
+* 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.spi.deployer;
+
+import java.net.URL;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.XMLConstants;
+
+import org.xml.sax.SAXException;
+
+/**
+ * Handle Schema.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SchemaHelper
+{
+ /**
+ * Get schema.
+ *
+ * @param schemaLocation the schema location
+ * @return schema or null if schema location is null
+ * @throws SAXException for any error
+ */
+ static Schema getSchema(String schemaLocation) throws SAXException
+ {
+ if (schemaLocation == null)
+ return null;
+
+ ClassLoader tcl = SecurityActions.getContextClassLoader();
+ URL schemaURL = tcl.getResource(schemaLocation);
+ if(schemaURL == null)
+ throw new IllegalStateException("Schema URL is null:" + schemaLocation);
+
+ SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ return factory.newSchema(schemaURL);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SchemaResolverDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -23,15 +23,18 @@
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSInputSource;
import org.jboss.xb.annotations.JBossXmlConstants;
+import org.jboss.xb.util.JBossXBHelper;
+import org.xml.sax.InputSource;
/**
* SchemaResolverDeployer.
*
* @param <T> the expected type
- * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision 1.1 $
*/
public class SchemaResolverDeployer<T> extends JBossXBDeployer<T>
@@ -90,14 +93,14 @@
{
if (isRegisterWithJBossXB())
{
- namespace = JBossXBDeployerHelper.findNamespace(getOutput());
+ namespace = JBossXBHelper.findNamespace(getOutput());
if (namespace == null || JBossXmlConstants.DEFAULT.equals(namespace))
throw new IllegalArgumentException(
"RegisterWithJBossXB is enabled, but cannot find namespace on class or package: " + getOutput() +
", perhaps missing @JBossXmlSchema or using default namespace attribute."
);
- JBossXBDeployerHelper.addClassBinding(namespace, getOutput());
+ JBossXBHelper.addClassBinding(namespace, getOutput());
}
}
@@ -109,7 +112,7 @@
if (isRegisterWithJBossXB())
{
// namespace should exist, since we got past create
- JBossXBDeployerHelper.removeClassBinding(namespace);
+ JBossXBHelper.removeClassBinding(namespace);
}
}
@@ -129,6 +132,8 @@
{
if (file == null)
throw new IllegalArgumentException("Null file");
- return getHelper().parse(file);
+
+ InputSource source = new VFSInputSource(file);
+ return getHelper().parse(source);
}
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SecurityActions.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SecurityActions.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/SecurityActions.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -27,11 +27,13 @@
import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedAction;
import org.jboss.virtual.VirtualFile;
/**
* @author Scott.Stark at jboss.org
+ * @author Ales.Justin at jboss.org
* @version $Revision: 60921 $
*/
public class SecurityActions
@@ -87,4 +89,26 @@
else
return FileActions.NON_PRIVILEGED.openStream(f);
}
+
+ static ClassLoader getContextClassLoader()
+ {
+ if (System.getSecurityManager() == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(GetContextClassLoader.INSTANCE);
+ }
+ }
+
+ static class GetContextClassLoader implements PrivilegedAction<ClassLoader>
+ {
+ static GetContextClassLoader INSTANCE = new GetContextClassLoader();
+
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ }
}
Modified: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/UnmarshallerFactoryDeployer.java
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/UnmarshallerFactoryDeployer.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/deployer/UnmarshallerFactoryDeployer.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -53,6 +53,7 @@
/**
* Create unmarshaller factory wrapper.
+ *
* @return the unmarshaller factory
*/
protected abstract UnmarshallerFactory<U> createUnmarshallerFactory();
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/AbstractStructureModificationChecker.java 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractStructureModificationChecker.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -49,6 +49,10 @@
/** The structure cache */
private StructureCache<T> cache;
+ protected AbstractStructureModificationChecker()
+ {
+ }
+
protected AbstractStructureModificationChecker(MainDeployerStructure mainDeployer)
{
if (mainDeployer == null)
@@ -81,6 +85,19 @@
}
/**
+ * Get main deployer structure.
+ *
+ * @return the main deployer structure
+ */
+ protected MainDeployerStructure getMainDeployerStructure()
+ {
+ if (mainDeployer == null)
+ throw new IllegalArgumentException("Null main deployer structure");
+
+ return mainDeployer;
+ }
+
+ /**
* Get deployment context.
*
* @param name the deployment context name
@@ -89,7 +106,7 @@
@SuppressWarnings("deprecation")
protected VFSDeploymentContext getDeploymentContext(String name)
{
- DeploymentContext deploymentContext = mainDeployer.getDeploymentContext(name);
+ DeploymentContext deploymentContext = getMainDeployerStructure().getDeploymentContext(name);
if (deploymentContext == null || deploymentContext instanceof VFSDeploymentContext == false)
return null;
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractSynchAdapter.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractSynchAdapter.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractSynchAdapter.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AbstractSynchAdapter.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,92 @@
+/*
+ * 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.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Abstract synch adapter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractSynchAdapter implements SynchAdapter
+{
+ /** The log */
+ protected static Logger log = Logger.getLogger(AbstractSynchAdapter.class);
+
+ public long add(VirtualFile fileToAdd, VirtualFile tempRoot, String pathToFile) throws IOException
+ {
+ try
+ {
+ URL realURL = VFSUtils.getRealURL(tempRoot);
+ File rootDir = new File(realURL.toURI());
+ File newFile = new File(rootDir, pathToFile);
+ return copy(fileToAdd, newFile);
+ }
+ catch (URISyntaxException e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+
+ /**
+ * Do copy.
+ *
+ * @param fileToAdd file to add
+ * @param newFile new file location
+ * @return new timestamp
+ * @throws IOException for any error
+ */
+ protected static long copy(VirtualFile fileToAdd, File newFile) throws IOException
+ {
+ FileOutputStream out = new FileOutputStream(newFile);
+ VFSUtils.copyStreamAndClose(fileToAdd.openStream(), out);
+ return newFile.lastModified();
+ }
+
+ public boolean delete(VirtualFile fileToDelete) throws IOException
+ {
+ return fileToDelete.delete();
+ }
+
+ /**
+ * Merge exception
+ */
+ static class MergeException extends IOException
+ {
+ MergeException(VirtualFile dest, VirtualFile source, Exception cause)
+ {
+ super("Conflict merging files, dest: " + dest + ", source: " + source);
+ initCause(cause);
+ }
+ }
+}
Copied: projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/AddVisitor.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,61 @@
+/*
+ * 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;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Synch on add file visitor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class AddVisitor extends SynchVisitor
+{
+ private VirtualFile tempRoot;
+ private int initialPathLenght;
+
+ public AddVisitor(VisitorAttributes attributes, StructureCache<Long> cache, SynchAdapter synchAdapter, VirtualFile tempRoot, int initialPathLenght)
+ {
+ super(attributes, cache, synchAdapter);
+ if (tempRoot == null)
+ throw new IllegalArgumentException("Null temp root");
+ if (initialPathLenght < 0)
+ throw new IllegalArgumentException("Initial path length is negative: " + initialPathLenght);
+
+ this.tempRoot = tempRoot;
+ this.initialPathLenght = initialPathLenght;
+ }
+
+ public void doVisit(VirtualFile file) throws Exception
+ {
+ String originalPathName = file.getPathName();
+ String pathName = originalPathName.substring(initialPathLenght);
+ VirtualFile child = tempRoot.getChild(pathName);
+ if (child == null)
+ {
+ // original was added
+ long timestamp = getSynchAdapter().add(file, tempRoot, pathName);
+ getCache().putCacheValue(originalPathName, timestamp);
+ }
+ }
+}
\ 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/MergeOverrideSynchAdapter.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeOverrideSynchAdapter.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeOverrideSynchAdapter.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeOverrideSynchAdapter.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -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 java.io.IOException;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Try merge first, fallback to override.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MergeOverrideSynchAdapter extends AbstractSynchAdapter
+{
+ public long update(VirtualFile fileToUpdate, VirtualFile modifiedFile) throws IOException
+ {
+ try
+ {
+ return MergeSynchAdapter.merge(fileToUpdate, modifiedFile);
+ }
+ catch (MergeException e)
+ {
+ return OverrideSynchAdapter.override(fileToUpdate, modifiedFile);
+ }
+ }
+}
\ 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/MergeSynchAdapter.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeSynchAdapter.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeSynchAdapter.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MergeSynchAdapter.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,53 @@
+/*
+ * 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.virtual.VirtualFile;
+
+/**
+ * Merge synch adapter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MergeSynchAdapter extends AbstractSynchAdapter
+{
+ public long update(VirtualFile fileToUpdate, VirtualFile modifiedFile) throws IOException
+ {
+ return merge(fileToUpdate, modifiedFile);
+ }
+
+ /**
+ * Do merge changes.
+ *
+ * @param fileToOverride the file to override
+ * @param modifiedFile the modifed file
+ * @return new timestamp
+ * @throws MergeException for possible merge conflict
+ * @throws java.io.IOException for any error
+ */
+ static long merge(VirtualFile fileToOverride, VirtualFile modifiedFile) throws IOException
+ {
+ return 0; // TODO
+ }
+}
\ 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/OverrideSynchAdapter.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/OverrideSynchAdapter.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/OverrideSynchAdapter.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/OverrideSynchAdapter.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,76 @@
+/*
+ * 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.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VFSUtils;
+
+/**
+ * Override synch adapter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class OverrideSynchAdapter extends AbstractSynchAdapter
+{
+ public long update(VirtualFile fileToUpdate, VirtualFile modifiedFile) throws IOException
+ {
+ return override(fileToUpdate, modifiedFile);
+ }
+
+ /**
+ * Do override.
+ *
+ * @param fileToOverride the file to override
+ * @param modifiedFile the modifed file
+ * @return new timestamp
+ * @throws IOException for any error
+ */
+ static long override(VirtualFile fileToOverride, VirtualFile modifiedFile) throws IOException
+ {
+ try
+ {
+ // get uri before we delete the file
+ URI uri = VFSUtils.getRealURL(fileToOverride).toURI();
+ if (fileToOverride.delete())
+ {
+ File newFile = new File(uri);
+ return copy(modifiedFile, newFile);
+ }
+ else
+ {
+ log.warn("Could not delete previous file: " + fileToOverride + ", no change applied: " + modifiedFile);
+ return fileToOverride.getLastModified();
+ }
+ }
+ catch (URISyntaxException e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+}
\ 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/SynchAdapter.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchAdapter.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchAdapter.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchAdapter.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,64 @@
+/*
+ * 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.virtual.VirtualFile;
+
+/**
+ * Synch adapter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface SynchAdapter
+{
+ /**
+ * Add new file to temp.
+ *
+ * @param fileToAdd file to add
+ * @param tempRoot temp root
+ * @param pathToFile the path to file
+ * @return addition timestamp
+ * @throws IOException for any error
+ */
+ long add(VirtualFile fileToAdd, VirtualFile tempRoot, String pathToFile) throws IOException;
+
+ /**
+ * Update file.
+ *
+ * @param fileToUpdate file to update
+ * @param modifiedFile the modified file
+ * @return the update timestamp
+ * @throws IOException for any error
+ */
+ long update(VirtualFile fileToUpdate, VirtualFile modifiedFile) throws IOException;
+
+ /**
+ * Add new file to temp.
+ *
+ * @param fileToDelete file to delete
+ * @throws IOException for any error
+ * @return true if deleted, false otherwise
+ */
+ boolean delete(VirtualFile fileToDelete) 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/SynchVisitor.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchVisitor.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchVisitor.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchVisitor.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,101 @@
+/*
+ * 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.logging.Logger;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Synch file visitor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public abstract class SynchVisitor implements VirtualFileVisitor
+{
+ protected final Logger log = Logger.getLogger(getClass());
+
+ private VisitorAttributes attributes;
+ private StructureCache<Long> cache;
+ private SynchAdapter synchAdapter;
+
+ protected SynchVisitor(VisitorAttributes attributes, StructureCache<Long> cache, SynchAdapter synchAdapter)
+ {
+ if (cache == null)
+ throw new IllegalArgumentException("Null cache");
+ if (synchAdapter == null)
+ throw new IllegalArgumentException("Null synch adapter");
+
+ if (attributes != null)
+ this.attributes = attributes;
+ else
+ this.attributes = VisitorAttributes.RECURSE_LEAVES_ONLY;
+ this.cache = cache;
+ this.synchAdapter = synchAdapter;
+ }
+
+ public VisitorAttributes getAttributes()
+ {
+ return attributes;
+ }
+
+ public void visit(VirtualFile file)
+ {
+ try
+ {
+ doVisit(file);
+ }
+ catch (Exception e)
+ {
+ log.warn("Exception synching file: " + file + ", cause: " + e);
+ }
+ }
+
+ /**
+ * Visit a virtual file
+ *
+ * @param file the virtual file being visited
+ * @throws Exception for any error
+ */
+ protected abstract void doVisit(VirtualFile file) throws Exception;
+
+ /**
+ * Get cache.
+ *
+ * @return the cache
+ */
+ protected StructureCache<Long> getCache()
+ {
+ return cache;
+ }
+
+ /**
+ * Get synch adapter.
+ *
+ * @return the syncj adapter
+ */
+ protected SynchAdapter getSynchAdapter()
+ {
+ return synchAdapter;
+ }
+}
\ 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/SynchWrapperModificationChecker.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/SynchWrapperModificationChecker.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,121 @@
+/*
+ * 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.structure.VFSDeploymentContext;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Synch wrapper modification checker.
+ *
+ * If there is no modification, we check if the deployment is perhaps a temp,
+ * only then checking if we need to update some resource.
+ * e.g. some .jsp or .xhtml file for JBossWeb to pick up the change
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class SynchWrapperModificationChecker extends AbstractStructureModificationChecker<Long>
+{
+ /** The true checker delegate */
+ private AbstractStructureModificationChecker<Long> delegate;
+
+ /** The synch adapter */
+ private SynchAdapter synchAdapter;
+
+ /** the visitor attributes */
+ private VisitorAttributes originalAttributes;
+ private VisitorAttributes tempAttributes;
+
+ public SynchWrapperModificationChecker(AbstractStructureModificationChecker<Long> delegate, SynchAdapter synchAdapter)
+ {
+ if (delegate == null)
+ throw new IllegalArgumentException("Null delegate");
+ if (synchAdapter == null)
+ throw new IllegalArgumentException("Null synch adapter");
+
+ this.delegate = delegate;
+ this.synchAdapter = synchAdapter;
+ }
+
+ @Override
+ protected StructureCache<Long> getCache()
+ {
+ return delegate.getCache();
+ }
+
+ @Override
+ protected MainDeployerStructure getMainDeployerStructure()
+ {
+ return delegate.getMainDeployerStructure();
+ }
+
+ protected boolean hasStructureBeenModifed(VirtualFile root, VFSDeploymentContext deploymentContext) throws IOException
+ {
+ boolean modified = delegate.hasStructureBeenModifed(root, deploymentContext);
+ // it was not modifed & we're actually temped
+ if (modified == false && root != deploymentContext.getRoot())
+ {
+ // check for update or delete
+ UpdateDeleteVisitor udVisitor = new UpdateDeleteVisitor(tempAttributes, getCache(), synchAdapter, root);
+ VirtualFile tempRoot = deploymentContext.getRoot();
+ tempRoot.visit(udVisitor);
+ // check for addition
+ AddVisitor addVisitor = new AddVisitor(originalAttributes, getCache(), synchAdapter, tempRoot, root.getPathName().length());
+ root.visit(addVisitor);
+ }
+ return modified;
+ }
+
+ public void addStructureRoot(VirtualFile root)
+ {
+ delegate.addStructureRoot(root);
+ }
+
+ public void removeStructureRoot(VirtualFile root)
+ {
+ delegate.removeStructureRoot(root);
+ }
+
+ /**
+ * Set original visitor attributes.
+ *
+ * @param attributes the attributes
+ */
+ public void setOriginalAttributes(VisitorAttributes attributes)
+ {
+ this.originalAttributes = attributes;
+ }
+
+ /**
+ * Set temp visitor attributes.
+ *
+ * @param attributes the attributes
+ */
+ public void setTempAttributes(VisitorAttributes attributes)
+ {
+ this.tempAttributes = attributes;
+ }
+}
\ 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/UpdateDeleteVisitor.java (from rev 87594, projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java)
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java (rev 0)
+++ projects/jboss-deployers/branches/Branch_2_0/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/UpdateDeleteVisitor.java 2009-04-20 21:20:27 UTC (rev 87597)
@@ -0,0 +1,84 @@
+/*
+ * 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;
+import org.jboss.virtual.VisitorAttributes;
+
+/**
+ * Synch on update and delete file visitor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class UpdateDeleteVisitor extends SynchVisitor
+{
+ private VirtualFile originalRoot;
+ private String initialPath;
+
+ public UpdateDeleteVisitor(VisitorAttributes attributes, StructureCache<Long> cache, SynchAdapter synchAdapter, VirtualFile originalRoot)
+ {
+ super(attributes, cache, synchAdapter);
+ if (originalRoot == null)
+ throw new IllegalArgumentException("Null original root");
+
+ this.originalRoot = originalRoot;
+ initialPath = originalRoot.getPathName();
+ if (initialPath.endsWith("/") == false)
+ initialPath += "/";
+ }
+
+ protected void doVisit(VirtualFile file) throws Exception
+ {
+ String pathName = file.getPathName();
+ String originalPathName = initialPath + pathName;
+ VirtualFile child = originalRoot.getChild(pathName);
+ if (child == null)
+ {
+ // original was deleted, try deleting the temp
+ if (getSynchAdapter().delete(file))
+ {
+ getCache().removeCache(originalPathName);
+ }
+ }
+ else
+ {
+ Long previous = getCache().getCacheValue(originalPathName);
+ long lastModified = child.getLastModified();
+
+ boolean updateCache = false;
+ if (previous == null)
+ {
+ updateCache = true;
+ }
+ else if (lastModified > previous)
+ {
+ lastModified = getSynchAdapter().update(file, child);
+ updateCache = true;
+ }
+
+ if (updateCache)
+ {
+ getCache().putCacheValue(originalPathName, lastModified);
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/branches/Branch_2_0/pom.xml
===================================================================
--- projects/jboss-deployers/branches/Branch_2_0/pom.xml 2009-04-20 21:14:46 UTC (rev 87596)
+++ projects/jboss-deployers/branches/Branch_2_0/pom.xml 2009-04-20 21:20:27 UTC (rev 87597)
@@ -21,20 +21,20 @@
</scm>
<properties>
- <version.jboss.vfs>2.1.0.GA</version.jboss.vfs>
- <version.jboss.man>2.0.0.GA</version.jboss.man>
+ <version.jboss.vfs>2.2.0.M3</version.jboss.vfs>
+ <version.jboss.man>2.1.0.CR8</version.jboss.man>
<version.jboss.mdr>2.0.1.GA</version.jboss.mdr>
- <version.jboss.microcontainer>2.0.4.GA</version.jboss.microcontainer>
- <version.jboss.classloader>2.0.3.GA</version.jboss.classloader>
+ <version.jboss.microcontainer>2.2.0.M1</version.jboss.microcontainer>
+ <version.jboss.classloader>2.2.0.M4</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.common.core>2.2.12.GA</version.jboss.common.core>
<version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
<version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
- <version.jbossxb>2.0.0.GA</version.jbossxb>
- <version.jboss.aop>2.0.0.SP1</version.jboss.aop>
+ <version.jbossxb>2.0.1.CR1</version.jbossxb>
+ <version.jboss.aop>2.1.0.CR3</version.jboss.aop>
<version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
<version.junit>4.4</version.junit>
- <version.javassist>3.9.0.GA</version.javassist>
+ <version.javassist>3.10.0.GA</version.javassist>
<version.stax.staxapi>1.0</version.stax.staxapi>
</properties>
More information about the jboss-cvs-commits
mailing list