[jboss-cvs] JBossAS SVN: r98940 - in projects/jboss-deployers/trunk: deployers-client-spi/src/main/java/org/jboss/deployers/client/spi and 17 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Dec 28 11:25:38 EST 2009
Author: alesj
Date: 2009-12-28 11:25:36 -0500 (Mon, 28 Dec 2009)
New Revision: 98940
Added:
projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataEntry.java
projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataType.java
projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/MetaDataEntryImpl.java
Modified:
projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java
projects/jboss-deployers/trunk/deployers-client/src/test/java/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java
projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java
projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java
projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/AbstractContextInfoTest.java
projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java
projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/FileModificationTypeMatcher.java
projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/ScanningMetaDataTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/ObjectMFDTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java
projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java
Log:
[JBDEPLOY-232]; differentiate between metadata locations.
Modified: projects/jboss-deployers/trunk/deployers-client/src/test/java/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-client/src/test/java/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-client/src/test/java/org/jboss/test/deployers/deploymentfactory/AbstractDeploymentFactoryTest.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -31,6 +31,8 @@
import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.test.BaseTestCase;
@@ -72,10 +74,11 @@
assertTrue(contextInfo.getMetaDataPath().isEmpty());
}
- protected static void assertDefaultMetaDataPath(List<String> metaDataPath)
+ protected static void assertDefaultMetaDataPath(List<MetaDataEntry> metaDataPath)
{
assertEquals(1, metaDataPath.size());
- assertEquals("metaDataPath", metaDataPath.get(0));
+ assertEquals("metaDataPath", metaDataPath.get(0).getPath());
+ assertEquals(MetaDataType.DEFAULT, metaDataPath.get(0).getType());
}
protected static void assertDefaultClassPath(List<ClassPathEntry> classPath)
Modified: projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-client-spi/src/main/java/org/jboss/deployers/client/spi/DeploymentFactory.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -21,6 +21,7 @@
*/
package org.jboss.deployers.client.spi;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -31,6 +32,8 @@
import org.jboss.deployers.spi.attachments.PredeterminedManagedObjectAttachments;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
@@ -88,7 +91,8 @@
public ContextInfo addContext(PredeterminedManagedObjectAttachments context, String path, String metaDataPath, List<ClassPathEntry> classPath)
{
StructureMetaData structure = assureStructure(context);
- ContextInfo result = StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+ MetaDataEntry entry = createMetaDataPathEntry(metaDataPath);
+ ContextInfo result = StructureMetaDataFactory.createContextInfo(path, entry, classPath);
structure.addContext(result);
return result;
}
@@ -106,12 +110,54 @@
public ContextInfo addContext(PredeterminedManagedObjectAttachments context, String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
{
StructureMetaData structure = assureStructure(context);
- ContextInfo result = StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+ ContextInfo result = StructureMetaDataFactory.createContextInfo(path, createMetaDataEntries(metaDataPath), classPath);
structure.addContext(result);
return result;
}
/**
+ * Create a new metadata path entry.
+ *
+ * @param path the path
+ * @return the metadata path entry
+ * @throws IllegalArgumentException for a null path
+ */
+ public static MetaDataEntry createMetaDataPathEntry(String path)
+ {
+ return StructureMetaDataFactory.createMetaDataEntry(path);
+ }
+
+ /**
+ * Create a new metadata path entry.
+ *
+ * @param path the path
+ * @param type the type
+ * @return the metadata path entry
+ * @throws IllegalArgumentException for a null path
+ */
+ public static MetaDataEntry createMetaDataPathEntry(String path, MetaDataType type)
+ {
+ return StructureMetaDataFactory.createMetaDataEntry(path, type);
+ }
+
+ /**
+ * Create metadata path entries.
+ *
+ * @param metaDataPath the metadata path entries
+ * @return the entries
+ */
+ public static List<MetaDataEntry> createMetaDataEntries(List<String> metaDataPath)
+ {
+ if (metaDataPath == null)
+ throw new IllegalArgumentException("Null metadata path");
+
+ List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>(metaDataPath.size());
+ for (String path : metaDataPath)
+ entries.add(createMetaDataPathEntry(path));
+ return entries;
+ }
+
+ /**
* Create a new classpath entry
*
* @param path the path
Modified: projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -32,6 +32,7 @@
import org.jboss.deployers.spi.attachments.helpers.PredeterminedManagedObjectAttachmentsImpl;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.spi.structure.ModificationType;
/**
@@ -52,8 +53,8 @@
private String path;
/** The metadata path */
- private List<String> metaDataPath;
-
+ private List<MetaDataEntry> metaDataPath;
+
/** The class path entries */
private List<ClassPathEntry> classPath = ClassPathEntryImpl.DEFAULT;
@@ -105,7 +106,7 @@
* @param classPath the class path
* @throws IllegalArgumentException for a null path or metadata path
*/
- public ContextInfoImpl(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ public ContextInfoImpl(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath)
{
setPath(path);
if (metaDataPath == null)
@@ -122,7 +123,7 @@
* @param classPath the class path
* @throws IllegalArgumentException for a null path or metadata path
*/
- public ContextInfoImpl(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+ public ContextInfoImpl(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath)
{
setPath(path);
setMetaDataPath(metaDataPath);
@@ -147,7 +148,7 @@
this.path = path;
}
- public List<String> getMetaDataPath()
+ public List<MetaDataEntry> getMetaDataPath()
{
if (metaDataPath == null)
return Collections.emptyList();
@@ -159,27 +160,27 @@
*
* @param metaDataPath the meta data paths
*/
- public void setMetaDataPath(List<String> metaDataPath)
+ public void setMetaDataPath(List<MetaDataEntry> metaDataPath)
{
this.metaDataPath = metaDataPath;
}
- public void addMetaDataPath(String path)
+ public void addMetaDataPath(MetaDataEntry entry)
{
- if (path == null)
+ if (entry == null)
throw new IllegalArgumentException("Null path");
if (metaDataPath == null)
- metaDataPath = Collections.singletonList(path);
+ metaDataPath = Collections.singletonList(entry);
else if (metaDataPath.size() == 1)
{
- List<String> paths = new ArrayList<String>();
+ List<MetaDataEntry> paths = new ArrayList<MetaDataEntry>();
paths.addAll(metaDataPath);
- paths.add(path);
+ paths.add(entry);
metaDataPath = paths;
}
else
- metaDataPath.add(path);
+ metaDataPath.add(entry);
}
public List<ClassPathEntry> getClassPath()
@@ -282,12 +283,10 @@
ContextInfo other = (ContextInfo) obj;
if (getPath().equals(other.getPath()) == false)
return false;
-
- List<String> thisMetaDataPath = getMetaDataPath();
- List<String> otherMetaDataPath = other.getMetaDataPath();
+ List<MetaDataEntry> thisMetaDataPath = getMetaDataPath();
+ List<MetaDataEntry> otherMetaDataPath = other.getMetaDataPath();
if (thisMetaDataPath.equals(otherMetaDataPath) == false)
return false;
-
List<ClassPathEntry> thisClassPath = getClassPath();
List<ClassPathEntry> otherClassPath = other.getClassPath();
if (thisClassPath == null)
@@ -308,7 +307,7 @@
setPath(in.readUTF());
boolean isEmptyMetaDataPath = in.readBoolean();
if (isEmptyMetaDataPath == false)
- setMetaDataPath((List<String>)in.readObject());
+ setMetaDataPath((List<MetaDataEntry>)in.readObject());
setClassPath((List) in.readObject());
setRelativeOrder(in.readInt());
boolean isNullComparator = in.readBoolean();
@@ -327,7 +326,7 @@
{
super.writeExternal(out);
out.writeUTF(getPath());
- List<String> metaDataPath = getMetaDataPath();
+ List<MetaDataEntry> metaDataPath = getMetaDataPath();
boolean isEmptyMetaDataPath = metaDataPath.isEmpty();
out.writeBoolean(isEmptyMetaDataPath);
if (isEmptyMetaDataPath == false)
Modified: projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/DefaultStructureMetaDataFactory.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -25,6 +25,8 @@
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
@@ -32,6 +34,7 @@
* DefaultStructureMetaDataFactory.
*
* @author <a href="adrian at jboss.org">Adrian Brock</a>
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class DefaultStructureMetaDataFactory extends StructureMetaDataFactory
@@ -51,16 +54,26 @@
return new ContextInfoImpl(path, classPath);
}
- protected ContextInfo newContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ protected ContextInfo newContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath)
{
return new ContextInfoImpl(path, metaDataPath, classPath);
}
- protected ContextInfo newContextInfo(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+ protected ContextInfo newContextInfo(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath)
{
return new ContextInfoImpl(path, metaDataPath, classPath);
}
+ protected MetaDataEntry newMetaDataPathEntry(String metaDataPath)
+ {
+ return newMetaDataPathEntry(metaDataPath, MetaDataType.DEFAULT);
+ }
+
+ protected MetaDataEntry newMetaDataPathEntry(String metaDataPath, MetaDataType type)
+ {
+ return new MetaDataEntryImpl(metaDataPath, type);
+ }
+
protected ClassPathEntry newClassPathEntry(String path, String suffixes)
{
return new ClassPathEntryImpl(path, suffixes);
Copied: projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/MetaDataEntryImpl.java (from rev 98870, projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/ContextInfoImpl.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/MetaDataEntryImpl.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-core/src/main/java/org/jboss/deployers/plugins/structure/MetaDataEntryImpl.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.plugins.structure;
+
+import java.io.Serializable;
+
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
+
+/**
+ * MetaDataEntryImpl
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MetaDataEntryImpl implements MetaDataEntry, Serializable
+{
+ private static long serialVersionUID = 1l;
+ private String path;
+ private MetaDataType type;
+
+ public MetaDataEntryImpl(String path)
+ {
+ this(path, MetaDataType.DEFAULT);
+ }
+
+ public MetaDataEntryImpl(String path, MetaDataType type)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+ if (type == null)
+ throw new IllegalArgumentException("Null type");
+ this.path = path;
+ this.type = type;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public MetaDataType getType()
+ {
+ return type;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return path.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof MetaDataEntry == false)
+ return false;
+
+ MetaDataEntry other = (MetaDataEntry)obj;
+ if (path.equals(other.getPath()) == false)
+ return false;
+
+ return type == other.getType();
+ }
+
+ @Override
+ public String toString()
+ {
+ return path + " - " + type;
+ }
+}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/AbstractContextInfoTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/AbstractContextInfoTest.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/AbstractContextInfoTest.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -25,6 +25,9 @@
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
/**
* AbstractContextInfoTest.
@@ -107,12 +110,30 @@
protected abstract ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath);
- protected static void assertDefaultMetaDataPath(List<String> metaDataPath)
+ protected void addMetaDataPath(ContextInfo context, String path)
{
+ MetaDataEntry entry = StructureMetaDataFactory.createMetaDataEntry(path);
+ context.addMetaDataPath(entry);
+ }
+
+ protected static void assertDefaultMetaDataPath(List<MetaDataEntry> metaDataPath)
+ {
assertEquals(1, metaDataPath.size());
- assertEquals("metaDataPath", metaDataPath.get(0));
+ assertEquals("metaDataPath", metaDataPath.get(0).getPath());
+ assertEquals(MetaDataType.DEFAULT, metaDataPath.get(0).getType());
}
+ protected static void assertMetaDataPaths(List<String> expected, List<MetaDataEntry> entries)
+ {
+ assertEquals(expected.size(), entries.size());
+ int i = 0;
+ for (String path : expected)
+ {
+ assertEquals(path, entries.get(i).getPath());
+ i++;
+ }
+ }
+
public void testConstructorPathAndMetaDataAndClassPath()
{
List<ClassPathEntry> classPath = createClassPath("ClassPath");
Modified: projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/ContextInfoImplUnitTestCase.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -21,17 +21,20 @@
*/
package org.jboss.test.deployers.structure.test;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
-import java.util.Arrays;
-import java.util.ArrayList;
import junit.framework.Test;
import junit.framework.TestSuite;
+
import org.jboss.deployers.plugins.attachments.AttachmentsImpl;
import org.jboss.deployers.plugins.structure.ClassPathEntryImpl;
import org.jboss.deployers.plugins.structure.ContextInfoImpl;
+import org.jboss.deployers.plugins.structure.MetaDataEntryImpl;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.test.deployers.structure.AbstractContextInfoTest;
/**
@@ -70,16 +73,19 @@
return new ContextInfoImpl(path, classPath);
}
- @Override
protected ContextInfo createPathAndMetaDataAndClassPath(String path, String metaDataPath, List<ClassPathEntry> classPath)
{
- return new ContextInfoImpl(path, metaDataPath, classPath);
+ MetaDataEntry entry = new MetaDataEntryImpl(metaDataPath);
+ return new ContextInfoImpl(path, entry, classPath);
}
@Override
protected ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
{
- return new ContextInfoImpl(path, metaDataPath, classPath);
+ List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>();
+ for (String mdp : metaDataPath)
+ entries.add(new MetaDataEntryImpl(mdp));
+ return new ContextInfoImpl(path, entries, classPath);
}
@Override
@@ -126,12 +132,12 @@
assertEquals("", context.getPath());
assertDefaultNonPath(context);
- context.addMetaDataPath("metaDataPath");
+ addMetaDataPath(context, "metaDataPath");
assertDefaultMetaDataPath(context.getMetaDataPath());
assertDefaultClassPath(context.getClassPath());
- context.addMetaDataPath("added");
- assertEquals(Arrays.asList("metaDataPath", "added"), context.getMetaDataPath());
+ addMetaDataPath(context, "added");
+ assertMetaDataPaths(Arrays.asList("metaDataPath", "added"), context.getMetaDataPath());
assertDefaultClassPath(context.getClassPath());
}
@@ -144,8 +150,8 @@
assertDefaultMetaDataPath(context.getMetaDataPath());
assertDefaultClassPath(context.getClassPath());
- context.addMetaDataPath("added");
- assertEquals(Arrays.asList("metaDataPath", "added"), context.getMetaDataPath());
+ addMetaDataPath(context, "added");
+ assertMetaDataPaths(Arrays.asList("metaDataPath", "added"), context.getMetaDataPath());
assertDefaultClassPath(context.getClassPath());
}
Modified: projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core/src/test/java/org/jboss/test/deployers/structure/test/StructureMetaDataFactoryContextInfoUnitTestCase.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -21,12 +21,15 @@
*/
package org.jboss.test.deployers.structure.test;
+import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
+
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
import org.jboss.test.deployers.structure.AbstractContextInfoTest;
@@ -69,13 +72,16 @@
@Override
protected ContextInfo createPathAndMetaDataAndClassPath(String path, String metaDataPath, List<ClassPathEntry> classPath)
{
- return StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+ return StructureMetaDataFactory.createContextInfo(path, StructureMetaDataFactory.createMetaDataEntry(metaDataPath), classPath);
}
@Override
protected ContextInfo createPathAndMetaDataAndClassPath(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
{
- return StructureMetaDataFactory.createContextInfo(path, metaDataPath, classPath);
+ List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>();
+ for (String mdp : metaDataPath)
+ entries.add(StructureMetaDataFactory.createMetaDataEntry(mdp));
+ return StructureMetaDataFactory.createContextInfo(path, entries, classPath);
}
@Override
Modified: projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ContextInfo.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -49,17 +49,17 @@
/**
* Get the logical path of the metdata location.
*
- * @return the path of the metdata location.
+ * @return the paths of the metdata location.
*/
- List<String> getMetaDataPath();
+ List<MetaDataEntry> getMetaDataPath();
/**
* Add the metaDataPath.
*
- * @param path the metaDataPath.
- * @throws IllegalArgumentException for a null path
+ * @param entry the metaDataPath entry.
+ * @throws IllegalArgumentException for a null entry
*/
- void addMetaDataPath(String path);
+ void addMetaDataPath(MetaDataEntry entry);
/**
* Get the classpath locations within the context
Copied: projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataEntry.java (from rev 98870, projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/ClassPathEntry.java)
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataEntry.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataEntry.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.spi.structure;
+
+import java.io.Serializable;
+
+/**
+ * A metadata entry.
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface MetaDataEntry extends Serializable
+{
+ /**
+ * Get the path relative to the context virtual file
+ *
+ * @return the path.
+ */
+ String getPath();
+
+ /**
+ * Get metadata type.
+ *
+ * e.g. some deployments have alternative metadata locations;
+ * JEE .war deployments -- WEB-INF/lib/somelib.jar/META-INF/ejb-jar.xml
+ *
+ * @return the metadata type
+ */
+ MetaDataType getType();
+}
\ No newline at end of file
Added: projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataType.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataType.java (rev 0)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/MetaDataType.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.deployers.spi.structure;
+
+/**
+ * A metadata type.
+ *
+ * @author <a href="ales.justin at jboss.org">Ales Justin</a>
+ */
+public enum MetaDataType
+{
+ DEFAULT,
+ ALTERNATIVE
+}
\ No newline at end of file
Modified: projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-core-spi/src/main/java/org/jboss/deployers/spi/structure/StructureMetaDataFactory.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -86,7 +86,7 @@
* @return the context info
* @throws IllegalArgumentException for a null path or metadata path
*/
- public static ContextInfo createContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath)
+ public static ContextInfo createContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath)
{
return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPath, classPath);
}
@@ -100,12 +100,35 @@
* @return the context info
* @throws IllegalArgumentException for a null path or metadata path
*/
- public static ContextInfo createContextInfo(String path, List<String> metaDataPath, List<ClassPathEntry> classPath)
+ public static ContextInfo createContextInfo(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath)
{
return StructureMetaDataBuilder.getInstance().newContextInfo(path, metaDataPath, classPath);
}
/**
+ * Create a new MetaData entry.
+ *
+ * @param metaDataPath the metadata path
+ * @return new metadata path entry
+ */
+ public static MetaDataEntry createMetaDataEntry(String metaDataPath)
+ {
+ return StructureMetaDataBuilder.getInstance().newMetaDataPathEntry(metaDataPath);
+ }
+
+ /**
+ * Create a new MetaData entry.
+ *
+ * @param metaDataPath the metadata path
+ * @param type the type
+ * @return new metadata path entry
+ */
+ public static MetaDataEntry createMetaDataEntry(String metaDataPath, MetaDataType type)
+ {
+ return StructureMetaDataBuilder.getInstance().newMetaDataPathEntry(metaDataPath, type);
+ }
+
+ /**
* Create a new classpath entry
*
* @return the classpath entry
@@ -175,7 +198,7 @@
* @return the context info
* @throws IllegalArgumentException for a null path or metadata path
*/
- protected abstract ContextInfo newContextInfo(String path, String metaDataPath, List<ClassPathEntry> classPath);
+ protected abstract ContextInfo newContextInfo(String path, MetaDataEntry metaDataPath, List<ClassPathEntry> classPath);
/**
* Create a new ContextInfo.
@@ -186,9 +209,28 @@
* @return the context info
* @throws IllegalArgumentException for a null path or metadata path
*/
- protected abstract ContextInfo newContextInfo(String path, List<String> metaDataPath, List<ClassPathEntry> classPath);
+ protected abstract ContextInfo newContextInfo(String path, List<MetaDataEntry> metaDataPath, List<ClassPathEntry> classPath);
/**
+ * Create new metadata path entry.
+ *
+ * @param metaDataPath the metadata path
+ * @return new metadata path entry
+ * @throws IllegalArgumentException for a null path or metadata path
+ */
+ protected abstract MetaDataEntry newMetaDataPathEntry(String metaDataPath);
+
+ /**
+ * Create new metadata path entry.
+ *
+ * @param metaDataPath the metadata path
+ * @param type the metadata path type
+ * @return new metadata path entry
+ * @throws IllegalArgumentException for a null path or metadata path
+ */
+ protected abstract MetaDataEntry newMetaDataPathEntry(String metaDataPath, MetaDataType type);
+
+ /**
* Create a new classpath entry
*
* @param path the path
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/AbstractVFSDeploymentContext.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -27,8 +27,12 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
@@ -57,7 +61,8 @@
private VirtualFile root;
/** The meta data locations */
- private List<VirtualFile> metaDataLocations;
+ /** This map usage is simply pair notion which simplifies API */
+ private Map<VirtualFile, MetaDataType> metaDataLocations;
/** The class paths */
private List<VirtualFile> classPath;
@@ -123,7 +128,7 @@
return root;
}
- public void setMetaDataPath(List<String> paths)
+ public void setMetaDataPath(List<MetaDataEntry> paths)
{
if (paths == null)
{
@@ -133,19 +138,20 @@
try
{
- List<VirtualFile> locations = new ArrayList<VirtualFile>();
- for (String path : paths)
+ Map<VirtualFile, MetaDataType> locations = new LinkedHashMap<VirtualFile, MetaDataType>();
+ for (MetaDataEntry entry : paths)
{
- if (path == null)
- throw new IllegalArgumentException("Null path in paths: " + paths);
+ if (entry == null)
+ throw new IllegalArgumentException("Null entry in paths: " + paths);
+ String path = entry.getPath();
VirtualFile child = root.getChild(path);
if (child != null)
- locations.add(child);
+ locations.put(child, entry.getType());
else
log.debug("Meta data path does not exist: root=" + root.getPathName() + " path=" + path);
}
- setMetaDataLocations(locations);
+ setMetaDataLocationsMap(locations);
}
catch (IOException e)
{
@@ -153,16 +159,6 @@
}
}
- /**
- * Get mutable metadata locations.
- *
- * @return the mutable metadata locations
- */
- protected List<VirtualFile> getMutableMetaDataLocations()
- {
- return metaDataLocations;
- }
-
public List<VirtualFile> getMetaDataLocations()
{
if (metaDataLocations == null || metaDataLocations.isEmpty())
@@ -171,12 +167,35 @@
}
else
{
- return Collections.unmodifiableList(metaDataLocations);
+ List<VirtualFile> result = new ArrayList<VirtualFile>();
+ for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet())
+ {
+ VirtualFile location = entry.getKey();
+ result.add(location);
+ }
+ return result;
}
}
public void setMetaDataLocations(List<VirtualFile> locations)
{
+ Map<VirtualFile, MetaDataType> locationsMap = null;
+ if (locations != null)
+ {
+ locationsMap = new LinkedHashMap<VirtualFile, MetaDataType>();
+ for (VirtualFile file : locations)
+ locationsMap.put(file, MetaDataType.DEFAULT);
+ }
+ setMetaDataLocationsMap(locationsMap);
+ }
+
+ /**
+ * Set metadata locations map.
+ *
+ * @param locations the metadata locations
+ */
+ protected void setMetaDataLocationsMap(Map<VirtualFile, MetaDataType> locations)
+ {
this.metaDataLocations = locations;
}
@@ -221,8 +240,9 @@
protected VirtualFile searchMetaDataLocations(String name)
{
VirtualFile result = null;
- for(VirtualFile location : getMetaDataLocations())
+ for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet())
{
+ VirtualFile location = entry.getKey();
try
{
result = location.getChild(name);
@@ -279,8 +299,9 @@
}
// Look in the meta data location
List<VirtualFile> results = new ArrayList<VirtualFile>();
- for (VirtualFile location : metaDataLocations)
+ for(Map.Entry<VirtualFile, MetaDataType> entry : metaDataLocations.entrySet())
{
+ VirtualFile location = entry.getKey();
List<VirtualFile> result = location.getChildren(filter);
if (result != null && result.isEmpty() == false)
{
@@ -304,18 +325,20 @@
if (locations == null)
throw new IllegalArgumentException("Null locations");
- List<VirtualFile> metadataLocations = getMutableMetaDataLocations();
- if (metadataLocations == null)
- metadataLocations = new ArrayList<VirtualFile>();
-
+ Map<VirtualFile, MetaDataType> locationsMap = new LinkedHashMap<VirtualFile, MetaDataType>();
for (int i = locations.length-1; i >= 0; --i)
{
VirtualFile location = locations[i];
if (location == null)
throw new IllegalArgumentException("Null virtual file in " + Arrays.toString(locations));
- metadataLocations.add(0, location);
+ locationsMap.put(location, MetaDataType.DEFAULT);
}
- setMetaDataLocations(metadataLocations);
+
+ // add the old ones
+ if (metaDataLocations != null)
+ locationsMap.putAll(metaDataLocations);
+
+ setMetaDataLocationsMap(locationsMap);
}
public void appendMetaDataLocation(VirtualFile... locations)
@@ -323,17 +346,17 @@
if (locations == null)
throw new IllegalArgumentException("Null location");
- List<VirtualFile> metaDataLocations = getMutableMetaDataLocations();
- if (metaDataLocations == null)
- metaDataLocations = new ArrayList<VirtualFile>();
+ Map<VirtualFile, MetaDataType> locationsMap = new LinkedHashMap<VirtualFile, MetaDataType>();
+ if (metaDataLocations != null)
+ locationsMap.putAll(metaDataLocations); // add the old ones
for (VirtualFile location : locations)
{
if (location == null)
throw new IllegalArgumentException("Null virtual file in " + Arrays.toString(locations));
- metaDataLocations.add(location);
+ locationsMap.put(location, MetaDataType.DEFAULT);
}
- setMetaDataLocations(metaDataLocations);
+ setMetaDataLocationsMap(locationsMap);
}
public void removeMetaDataLocation(VirtualFile... locations)
@@ -507,7 +530,7 @@
root = (VirtualFile) in.readObject();
boolean isNullOrEmpty = in.readBoolean();
if (isNullOrEmpty == false)
- metaDataLocations = (List<VirtualFile>) in.readObject();
+ metaDataLocations = (Map<VirtualFile, MetaDataType>) in.readObject();
classPath = (List) in.readObject();
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructuralDeployersImpl.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -23,15 +23,16 @@
import java.util.Arrays;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import java.util.List;
import org.jboss.deployers.client.spi.Deployment;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.Ordered;
import org.jboss.deployers.spi.attachments.MutableAttachments;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
import org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers;
@@ -151,7 +152,7 @@
// Create the context in the parent structure
ContextInfo parentContextInfo;
- List<String> metaDataPath = recognised.getMetaDataPath();
+ List<MetaDataEntry> metaDataPath = recognised.getMetaDataPath();
if (metaDataPath == null || metaDataPath.isEmpty())
parentContextInfo = StructureMetaDataFactory.createContextInfo(relativePath, recognised.getClassPath());
else
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/VFSStructureBuilder.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -29,14 +29,15 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.spi.structure.ModificationType;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.structure.spi.helpers.AbstractStructureBuilder;
+import org.jboss.deployers.vfs.plugins.structure.modify.ModificationAction;
+import org.jboss.deployers.vfs.plugins.structure.modify.ModificationActions;
import org.jboss.deployers.vfs.spi.client.VFSDeployment;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
-import org.jboss.deployers.vfs.plugins.structure.modify.ModificationAction;
-import org.jboss.deployers.vfs.plugins.structure.modify.ModificationActions;
import org.jboss.logging.Logger;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
@@ -154,7 +155,7 @@
log.trace("Apply context: " + context.getName() + " " + contextInfo);
VFSDeploymentContext vfsContext = (VFSDeploymentContext) context;
- List<String> metaDataPath = contextInfo.getMetaDataPath();
+ List<MetaDataEntry> metaDataPath = contextInfo.getMetaDataPath();
if (metaDataPath != null && metaDataPath.isEmpty() == false)
vfsContext.setMetaDataPath(contextInfo.getMetaDataPath());
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/dir/DirectoryStructure.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -25,6 +25,7 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
import org.jboss.deployers.vfs.spi.structure.StructureContext;
@@ -89,12 +90,12 @@
StructureMetaData smd = parentContext.getMetaData();
ContextInfo info = smd.getContext("");
- List<String> metadataPaths = info.getMetaDataPath();
+ List<MetaDataEntry> metadataPaths = info.getMetaDataPath();
if (metadataPaths != null && metadataPaths.isEmpty() == false)
{
String relativePath = AbstractStructureDeployer.getRelativePath(context.getParent(), context.getFile());
- for (String path : metadataPaths)
- if (relativePath.equalsIgnoreCase(path))
+ for (MetaDataEntry entry : metadataPaths)
+ if (relativePath.equalsIgnoreCase(entry.getPath()))
return true;
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/explicit/StructureMetaDataObjectFactory.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -26,8 +26,10 @@
import org.jboss.deployers.plugins.structure.ClassPathEntryImpl;
import org.jboss.deployers.plugins.structure.ContextInfoImpl;
+import org.jboss.deployers.plugins.structure.MetaDataEntryImpl;
import org.jboss.deployers.plugins.structure.StructureMetaDataImpl;
import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.spi.structure.ModificationType;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.UnmarshallingContext;
@@ -83,20 +85,21 @@
parent.setPath(path);
}
else if ("metaDataPath".equals(localName))
- child = new LinkedHashSet<String>();
+ child = new LinkedHashSet<MetaDataEntry>();
else if (localName.equals("classpath"))
child = new ArrayList<ClassPathEntry>();
return child;
}
- public Object newChild(LinkedHashSet<String> parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ public Object newChild(LinkedHashSet<MetaDataEntry> parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
Object child = null;
if("path".equals(localName))
{
String path = attrs.getValue("name");
- parent.add(path);
+ MetaDataEntry entry = new MetaDataEntryImpl(path);
+ parent.add(entry);
}
return child;
}
@@ -119,9 +122,9 @@
parent.addContext(context);
}
- public void addChild(ContextInfoImpl context, LinkedHashSet<String> metaDataPath, UnmarshallingContext navigator, String namespaceURI, String localName)
+ public void addChild(ContextInfoImpl context, LinkedHashSet<MetaDataEntry> metaDataPath, UnmarshallingContext navigator, String namespaceURI, String localName)
{
- context.setMetaDataPath(new ArrayList<String>(metaDataPath));
+ context.setMetaDataPath(new ArrayList<MetaDataEntry>(metaDataPath));
}
public void addChild(ContextInfoImpl context, ArrayList<ClassPathEntry> classpath, UnmarshallingContext navigator, String namespaceURI, String localName)
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/FileModificationTypeMatcher.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/FileModificationTypeMatcher.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/modify/FileModificationTypeMatcher.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -26,6 +26,7 @@
import java.util.ArrayList;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.virtual.VirtualFile;
/**
@@ -77,7 +78,7 @@
{
if (metadataOnly)
{
- List<String> metadataPaths = contextInfo.getMetaDataPath();
+ List<MetaDataEntry> metadataPaths = contextInfo.getMetaDataPath();
if (metadataPaths == null || metadataPaths.isEmpty())
{
return Collections.emptyList();
@@ -85,11 +86,11 @@
else
{
List<VirtualFile> result = new ArrayList<VirtualFile>(metadataPaths.size());
- for (String metadataPath : metadataPaths)
+ for (MetaDataEntry metadataPath : metadataPaths)
{
try
{
- VirtualFile child = file.getChild(metadataPath);
+ VirtualFile child = file.getChild(metadataPath.getPath());
if (child != null)
result.add(child);
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/main/java/org/jboss/deployers/vfs/plugins/structure/war/WARStructure.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -27,6 +27,7 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
import org.jboss.deployers.vfs.spi.structure.StructureContext;
import org.jboss.virtual.VirtualFile;
@@ -46,10 +47,10 @@
/** The default filter which allows jars/jar directories */
public static final VirtualFileFilter DEFAULT_WEB_INF_LIB_FILTER = new SuffixMatchFilter(".jar", VisitorAttributes.DEFAULT);
- /** The web-inf/lib filter */
+ /** The WEB-INF/lib filter */
private VirtualFileFilter webInfLibFilter = DEFAULT_WEB_INF_LIB_FILTER;
- /** The web-inf/lib/[some-archive]/META-INF filter */
+ /** The WEB-INF/lib/[some-archive]/META-INF filter */
private VirtualFileFilter webInfLibMetaDataFilter;
/** Whether to include web-inf in the classpath */
@@ -178,6 +179,9 @@
log.warn("Exception while looking for classes, " + file.getPathName() + ", " + e);
}
+ // Create a context for this war file and all its metadata locations
+ context = createContext(structureContext, metaDataLocations.toArray(new String[metaDataLocations.size()]));
+
// Check for jars in WEB-INF/lib
List<VirtualFile> archives = null;
try
@@ -191,7 +195,7 @@
{
// either same as plain lib filter, null or accepts the jar
if (webInfLibMetaDataFilter == null || webInfLibMetaDataFilter == webInfLibFilter || webInfLibMetaDataFilter.accepts(jar))
- metaDataLocations.add("WEB-INF/lib/" + jar.getName() + "/META-INF");
+ addMetaDataPath(structureContext, context, "WEB-INF/lib/" + jar.getName() + "/META-INF", MetaDataType.ALTERNATIVE);
}
}
}
@@ -200,9 +204,6 @@
log.warn("Exception looking for WEB-INF/lib, " + file.getPathName() + ", " + e);
}
- // Create a context for this war file and all its metadata locations
- context = createContext(structureContext, metaDataLocations.toArray(new String[metaDataLocations.size()]));
-
// Add the war manifest classpath entries
addClassPath(structureContext, file, false, true, context);
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/BaseDeployersVFSTest.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -22,9 +22,13 @@
package org.jboss.test.deployers;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
import org.jboss.deployers.client.spi.DeployerClient;
import org.jboss.deployers.plugins.main.MainDeployerImpl;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
import org.jboss.deployers.structure.spi.StructuralDeployers;
import org.jboss.deployers.structure.spi.StructureBuilder;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentContext;
@@ -159,4 +163,18 @@
VirtualFile file = getVirtualFile(root, path);
return new AbstractVFSDeploymentContext(file, "");
}
+
+ /**
+ * Create metadata path entries.
+ *
+ * @param metaDataPath the metadata paths
+ * @return the metadata path entries
+ */
+ protected List<MetaDataEntry> createMetaDataEntries(String... metaDataPath)
+ {
+ List<MetaDataEntry> entries = new ArrayList<MetaDataEntry>();
+ for (String path : metaDataPath)
+ entries.add(StructureMetaDataFactory.createMetaDataEntry(path));
+ return entries;
+ }
}
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/ScanningMetaDataTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/ScanningMetaDataTestCase.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/annotations/test/ScanningMetaDataTestCase.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -21,15 +21,15 @@
*/
package org.jboss.test.deployers.vfs.annotations.test;
-import java.util.Collections;
import java.util.List;
import java.util.Set;
import junit.framework.Test;
+
import org.jboss.deployers.plugins.annotations.AbstractScanningMetaData;
+import org.jboss.deployers.spi.annotations.PathEntryMetaData;
import org.jboss.deployers.spi.annotations.PathMetaData;
import org.jboss.deployers.spi.annotations.ScanningMetaData;
-import org.jboss.deployers.spi.annotations.PathEntryMetaData;
import org.jboss.deployers.vfs.plugins.annotations.ScanningMetaDataDeployer;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentContext;
import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentUnit;
@@ -62,7 +62,7 @@
{
VirtualFile file = getVirtualFile("/scanning", "smoke");
VFSDeploymentContext deployment = new AbstractVFSDeploymentContext(file, "");
- deployment.setMetaDataPath(Collections.singletonList("META-INF"));
+ deployment.setMetaDataPath(createMetaDataEntries("META-INF"));
VFSDeploymentUnit unit = new AbstractVFSDeploymentUnit(deployment);
deployer.deploy(unit);
try
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/ObjectMFDTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/ObjectMFDTestCase.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/deployer/validate/test/ObjectMFDTestCase.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -21,9 +21,8 @@
*/
package org.jboss.test.deployers.vfs.deployer.validate.test;
-import java.util.Collections;
-
import junit.framework.Test;
+
import org.jboss.deployers.spi.deployer.Deployer;
import org.jboss.deployers.spi.structure.ContextInfo;
import org.jboss.deployers.spi.structure.StructureMetaData;
@@ -56,7 +55,7 @@
{
VirtualFile file = getVirtualFile("/structure/explicit", "complex.deployer");
VFSDeploymentContext deployment = new AbstractVFSDeploymentContext(file, "");
- deployment.setMetaDataPath(Collections.singletonList("META-INF"));
+ deployment.setMetaDataPath(createMetaDataEntries("META-INF"));
VFSDeploymentUnit unit = new AbstractVFSDeploymentUnit(deployment);
Deployer deployer = new StructureOMFDeployer();
@@ -76,7 +75,7 @@
{
VirtualFile file = getVirtualFile("/structure/explicit", "comparator.jar");
VFSDeploymentContext deployment = new AbstractVFSDeploymentContext(file, "");
- deployment.setMetaDataPath(Collections.singletonList("META-INF"));
+ deployment.setMetaDataPath(createMetaDataEntries("META-INF"));
VFSDeploymentUnit unit = new AbstractVFSDeploymentUnit(deployment);
Deployer deployer = new StructureOMFDeployer();
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/metadata/test/MetaDataUnitTestCase.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -21,13 +21,16 @@
*/
package org.jboss.test.deployers.vfs.metadata.test;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import junit.framework.Test;
import junit.framework.TestSuite;
+
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
import org.jboss.test.deployers.BaseDeployersVFSTest;
import org.jboss.test.deployers.vfs.metadata.support.ServicesFilter;
@@ -83,7 +86,7 @@
public void testExactMatchMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
String expected = getVfsURL("/metadata/toplevel/metadata.jar/META-INF/jboss-service.xml");
assertMetaDataMatch(context, expected, "jboss-service.xml");
}
@@ -91,28 +94,28 @@
public void testNotExactMatchMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, "not-correct.xml");
}
public void testExactMatchNoMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, "jboss-service.xml");
}
public void testNotExactMatchNoMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, "not-correct.xml");
}
public void testPartialMatchMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
Set<String> expected = new HashSet<String>();
expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/1-ds.xml"));
expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/2-ds.xml"));
@@ -122,28 +125,28 @@
public void testNotPartialMatchMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, null, "-not.xml");
}
public void testPartialMatchNoMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, null, "-ds.xml");
}
public void testNotPartialMatchNoMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, null, "-not.xml");
}
public void testExactAndPartialMatchMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
Set<String> expected = new HashSet<String>();
expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/jboss-service.xml"));
expected.add(getVfsURL("/metadata/toplevel/metadata.jar/META-INF/1-ds.xml"));
@@ -154,28 +157,28 @@
public void testNotExactAndPartialMatchMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, "not-correct.xml", "-not.xml");
}
public void testExactAndPartialMatchNoMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, "jboss-service.xml", "-ds.xml");
}
public void testNotExactAndPartialMatchNoMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-nometainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
assertNoMetaDataMatch(context, "jboss-service.xml", "-not.xml");
}
public void testRecurseInMetaInf() throws Exception
{
VFSDeploymentContext context = createDeploymentContext("/metadata", "toplevel/metadata-recurseinmetainf.jar");
- context.setMetaDataPath(Collections.singletonList("META-INF"));
+ context.setMetaDataPath(createMetaDataEntries("META-INF"));
VirtualFileFilter filter = new ServicesFilter();
Set<String> expected = new HashSet<String>();
expected.add(getVfsURL("/metadata/toplevel/metadata-recurseinmetainf.jar/META-INF/jboss-service.xml"));
Modified: projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs/src/test/java/org/jboss/test/deployers/vfs/structurebuilder/test/VFSStructureBuilderUnitTestCase.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -30,6 +30,7 @@
import org.jboss.deployers.client.spi.DeploymentFactory;
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.deployers.vfs.plugins.client.AbstractVFSDeployment;
import org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder;
@@ -105,7 +106,7 @@
protected void checkMetaDataLocation(VFSDeploymentContext context, ContextInfo contextInfo) throws Exception
{
- List<String> metaDataPaths = contextInfo.getMetaDataPath();
+ List<MetaDataEntry> metaDataPaths = contextInfo.getMetaDataPath();
assertNotNull(metaDataPaths);
List<VirtualFile> metaDataLocations = context.getMetaDataLocations();
assertNotNull(metaDataLocations);
@@ -115,7 +116,7 @@
else
{
VirtualFile root = context.getRoot();
- VirtualFile expected = root.findChild(metaDataPaths.get(0));
+ VirtualFile expected = root.findChild(metaDataPaths.get(0).getPath());
assertEquals(1, metaDataLocations.size());
assertEquals(expected, metaDataLocations.get(0));
}
Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/VFSDeploymentContext.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -23,6 +23,7 @@
import java.util.List;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
import org.jboss.deployers.structure.spi.DeploymentContext;
import org.jboss.virtual.VirtualFile;
import org.jboss.virtual.VirtualFileFilter;
@@ -48,7 +49,7 @@
*
* @param paths the path
*/
- void setMetaDataPath(List<String> paths);
+ void setMetaDataPath(List<MetaDataEntry> paths);
/**
* Get the meta data locations
Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/helpers/AbstractStructureDeployer.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -30,6 +30,8 @@
import org.jboss.deployers.spi.structure.ClassPathEntry;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.spi.structure.StructureMetaDataFactory;
import org.jboss.deployers.vfs.spi.structure.CandidateAnnotationsCallback;
@@ -437,7 +439,7 @@
// Create and link the context
if (metaDataPath != null)
- return StructureMetaDataFactory.createContextInfo("", metaDataPath, null);
+ return StructureMetaDataFactory.createContextInfo("", createMetaDataEntry(metaDataPath), null);
else
return StructureMetaDataFactory.createContextInfo("", null);
}
@@ -458,6 +460,51 @@
}
/**
+ * Create metadata entry.
+ *
+ * @param path the path
+ * @return the metadata entry
+ */
+ private MetaDataEntry createMetaDataEntry(String path)
+ {
+ return StructureMetaDataFactory.createMetaDataEntry(path);
+ }
+
+ /**
+ * Create metadata entry.
+ *
+ * @param path the path
+ * @param type the type
+ * @return the metadata entry
+ */
+ private MetaDataEntry createMetaDataEntry(String path, MetaDataType type)
+ {
+ return StructureMetaDataFactory.createMetaDataEntry(path, type);
+ }
+
+ /**
+ * Create metadata entry.
+ *
+ * @param context the structure context
+ * @param info the context info
+ * @param path the path
+ * @param type the type
+ */
+ protected void addMetaDataPath(StructureContext context, ContextInfo info, String path, MetaDataType type)
+ {
+ VirtualFile root = context.getFile();
+ try
+ {
+ if (root.getChild(path) != null)
+ info.addMetaDataPath(createMetaDataEntry(path, type));
+ }
+ catch (IOException e)
+ {
+ log.warn("Not using metadata path " + path + " for " + root.getName() + " reason: " + e.getMessage());
+ }
+ }
+
+ /**
* Apply metadata on root to create context.
*
* @param context the structure context
@@ -470,7 +517,7 @@
throw new IllegalArgumentException("Null context");
VirtualFile root = context.getFile();
- List<String> metaDataPath = CollectionsFactory.createLazyList();
+ List<MetaDataEntry> metaDataPath = CollectionsFactory.createLazyList();
// Determine whether the metadata paths exists
if (metaDataPaths != null && metaDataPaths.length > 0)
{
@@ -480,7 +527,7 @@
{
VirtualFile child = root.getChild(path);
if (child != null)
- metaDataPath.add(path);
+ metaDataPath.add(createMetaDataEntry(path));
}
catch (IOException e)
{
Modified: projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java
===================================================================
--- projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java 2009-12-28 04:42:52 UTC (rev 98939)
+++ projects/jboss-deployers/trunk/deployers-vfs-spi/src/main/java/org/jboss/deployers/vfs/spi/structure/modified/MetaDataStructureModificationChecker.java 2009-12-28 16:25:36 UTC (rev 98940)
@@ -27,6 +27,8 @@
import java.util.Set;
import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.MetaDataEntry;
+import org.jboss.deployers.spi.structure.MetaDataType;
import org.jboss.deployers.spi.structure.StructureMetaData;
import org.jboss.deployers.structure.spi.main.MainDeployerInternals;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentContext;
@@ -132,11 +134,15 @@
VirtualFile contextRoot = root.getChild(path);
if (contextRoot != null)
{
- List<String> metadataPaths = contextInfo.getMetaDataPath();
+ List<MetaDataEntry> metadataPaths = contextInfo.getMetaDataPath();
if (metadataPaths != null && metadataPaths.isEmpty() == false)
{
- for (String metaDataPath : metadataPaths)
+ for (MetaDataEntry entry : metadataPaths)
{
+ if (entry.getType() != MetaDataType.DEFAULT)
+ continue;
+
+ String metaDataPath = entry.getPath();
VirtualFile mdpVF = contextRoot.getChild(metaDataPath);
if (mdpVF != null)
{
More information about the jboss-cvs-commits
mailing list