[jboss-cvs] JBossAS SVN: r92566 - in projects/profileservice/trunk: core and 37 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 19 05:31:21 EDT 2009


Author: emuckenhuber
Date: 2009-08-19 05:31:21 -0400 (Wed, 19 Aug 2009)
New Revision: 92566

Added:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepositoryBase.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualRepositoryMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualPath.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java
   projects/profileservice/trunk/core/src/test/resources/org/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/simple-deployer-jboss-beans.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/META-INF/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/META-INF/jboss-beans.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/child/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/child/META-INF/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/child/META-INF/jboss-beans.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/child/test.jar
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/lib/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/lib/deployment.jar
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/deployer.jar
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/bad.jar
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/fake.jar
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/fake2.jar
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf/test.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf/test1.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf2/
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf2/exclude-beans.xml
   projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf2/include.xml
   projects/profileservice/trunk/sandbox/src/test/resources/log4j.properties
   projects/profileservice/trunk/sandbox/src/test/resources/org/
   projects/profileservice/trunk/sandbox/src/test/resources/org/jboss/
   projects/profileservice/trunk/sandbox/src/test/resources/org/jboss/test/
   projects/profileservice/trunk/sandbox/src/test/resources/org/jboss/test/profileservice/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/ClassPathLocation.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/MetaDataLocation.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/PathRestriction.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualDeployment.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualPathMetaData.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java
Removed:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java
Modified:
   projects/profileservice/trunk/
   projects/profileservice/trunk/core/pom.xml
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
   projects/profileservice/trunk/sandbox/pom.xml
   projects/profileservice/trunk/spi/pom.xml
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java
Log:
[JBPROFILE-3] initial virtual deployment work


Property changes on: projects/profileservice/trunk
___________________________________________________________________
Name: svn:ignore
   - .classpath
.project
target

   + .classpath
.project
.settings
target


Modified: projects/profileservice/trunk/core/pom.xml
===================================================================
--- projects/profileservice/trunk/core/pom.xml	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/core/pom.xml	2009-08-19 09:31:21 UTC (rev 92566)
@@ -18,12 +18,13 @@
 			<groupId>org.jboss.logging</groupId>
 			<artifactId>jboss-logging-log4j</artifactId>
 			<version>2.1.0.GA</version>
+			<scope>provided</scope>
 		</dependency>
 	
 		<dependency>
-			<groupId>org.jboss.profileservice</groupId>
-			<artifactId>jboss-profileservice-spi</artifactId>
-			<version>${project.parent.version}</version>
+			<groupId>org.jboss.deployers</groupId>
+			<artifactId>jboss-deployers-vfs</artifactId>
+			<version>${version.org.jboss.deployers}</version>
 			<scope>provided</scope>
 		</dependency>
 
@@ -42,6 +43,12 @@
 		</dependency>
 
 		<dependency>
+			<groupId>org.jboss.profileservice</groupId>
+			<artifactId>jboss-profileservice-spi</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+
+		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
 			<scope>test</scope>

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/deployers/VDFDeploymentBuilder.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.deployers;
+
+import org.jboss.deployers.client.plugins.deployment.AbstractDeployment;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.virtual.assembly.StructureMetaDataBuilder;
+
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class VDFDeploymentBuilder
+{
+ 
+   /** The instance. */
+   private static final VDFDeploymentBuilder instance = new VDFDeploymentBuilder();
+   
+   /** The vfs deployment factory. */
+   private static final VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+
+   /** A strcuture meta data plugin. */
+   private static StructureMetaDataBuilder structureMetaDataBuilder = new StructureMetaDataBuilder();
+   
+   public static VDFDeploymentBuilder getInstance()
+   {
+      return instance;
+   }
+   
+   public Deployment createDeployment(ProfileDeployment deployment)
+   {
+      Deployment d = null;
+      if(deployment.getRoot() == null)
+      {
+         d = new AbstractDeployment(deployment.getName());
+      }
+      else
+      {
+         d = deploymentFactory.createVFSDeployment(deployment.getRoot());
+      }
+      return structureMetaDataBuilder.processDeployment(deployment, d);
+   }
+   
+}

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/AbstractVFSProfileSource.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -34,6 +34,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.jboss.logging.Logger;
+import org.jboss.profileservice.repository.ProfileDeploymentFactory;
 import org.jboss.profileservice.spi.NoSuchDeploymentException;
 import org.jboss.profileservice.spi.NoSuchProfileException;
 import org.jboss.profileservice.spi.ProfileDeployment;
@@ -71,6 +72,9 @@
    /** The logger. */
    protected final Logger log = Logger.getLogger(getClass());
    
+   /** The deployment factory. */
+   private final static ProfileDeploymentFactory deploymentFacotry = ProfileDeploymentFactory.getInstance();
+   
    public AbstractVFSProfileSource(URI[] uris)
    {
       if(uris == null)
@@ -360,11 +364,10 @@
     * 
     * @param vf the deployment root
     * @return the profile deployment
-    * @throws Exception
     */
-   protected static ProfileDeployment createDeployment(VirtualFile vf) throws Exception
+   protected static ProfileDeployment createDeployment(VirtualFile vf)
    {
-      return new ProfileVFSDeployment(vf);
+      return deploymentFacotry.createDeployment(vf);
    }
    
    /**

Deleted: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/profile/ProfileVFSDeployment.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.profileservice.profile;
-
-import org.jboss.profileservice.spi.helpers.AbstractProfileDeployment;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A basic VFS based ProfileDeployment.
- * 
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ProfileVFSDeployment extends AbstractProfileDeployment
-{
-
-   /** The serialVersionUID */
-   private static final long serialVersionUID = 7214390961641933878L;
-
-   public ProfileVFSDeployment(VirtualFile root)
-   {
-      setName(safeVirtualFileName(root));
-      setRoot(root);
-   }
-   
-}
-

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/BasicProfileDeployment.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.repository;
+
+import org.jboss.profileservice.spi.helpers.AbstractProfileDeployment;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * The basic profile deployment.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicProfileDeployment extends AbstractProfileDeployment
+{
+   
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -1L;
+
+   public BasicProfileDeployment(String name)
+   {
+      super(name);
+   }
+   
+   public BasicProfileDeployment(VirtualFile vf)
+   {
+      this(safeVirtualFileName(vf));
+      setRoot(vf);
+   }
+   
+   public BasicProfileDeployment(VirtualFile vf, VirtualDeploymentAssemblyContext ctx)
+   {
+      this(vf);
+      addAttachment(VirtualDeploymentAssemblyContext.class.getName(), ctx);
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/ProfileDeploymentFactory.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.repository;
+
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+import org.jboss.profileservice.virtual.assembly.AbstractVirtualDeploymentAssembly;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * The profile deployment factory.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ProfileDeploymentFactory extends AbstractVirtualDeploymentAssembly
+{
+   
+   /** The instance. */
+   private static final ProfileDeploymentFactory instance = new ProfileDeploymentFactory();
+
+   public static ProfileDeploymentFactory getInstance()
+   {
+      return instance;
+   }
+
+   public ProfileDeployment createDeployment(String name)
+   {
+      if(name == null)
+         throw new IllegalArgumentException("null deployment name");
+      return new BasicProfileDeployment(name);
+   }
+   
+   public ProfileDeployment createDeployment(VirtualFile vf)
+   {
+      if(vf == null)
+         throw new IllegalArgumentException("null virtual file");
+      return new BasicProfileDeployment(vf);
+   }
+   
+   public ProfileDeployment createDeployment(VirtualDeployment deployment) throws Exception
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("null virtual deployment");
+      
+      // Assemble the virtual deployment
+      VirtualDeploymentAssemblyContext ctx = assemble(deployment);
+      VirtualFile vf = ctx.getRoot();
+      if(vf == null)
+         throw new IllegalStateException("Assembled null virtual file");
+      
+      return new BasicProfileDeployment(vf, ctx);
+   }
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepositoryBase.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepositoryBase.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepositoryBase.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.repository.virtual;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class VirtualDeploymentRepositoryBase
+{
+
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualRepositoryMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualRepositoryMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualRepositoryMetaData.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.repository.virtual;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.profileservice.virtual.deployment.AbstractVirtualDeployment;
+import org.jboss.xb.annotations.JBossXmlSchema;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlRootElement(name = "virtual-repository")
+ at JBossXmlSchema(ignoreUnresolvedFieldOrClass=false,
+      namespace= "urn:jboss:profileservice:virtual:repository:1.0",
+      elementFormDefault=XmlNsForm.QUALIFIED,
+      normalizeSpace=true)
+ at XmlType(name = "virtualRepositoryType", propOrder = "deployments")
+public class VirtualRepositoryMetaData
+{
+
+   /** The deployments. */
+   private List<VirtualDeployment> deployments;
+
+   @XmlElement(name = "virtual-deployment", type = AbstractVirtualDeployment.class)
+   public List<VirtualDeployment> getDeployments()
+   {
+      return deployments;
+   }
+   
+   public void setDeployments(List<VirtualDeployment> deployments)
+   {
+      this.deployments = deployments;
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualAssemblyContext.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.assembly;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.profileservice.spi.virtual.assembly.VirtualAssemblyContext;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+
+/**
+ * A abstract virtual assembly context.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractVirtualAssemblyContext implements VirtualAssemblyContext
+{
+
+   /** The meta data locations. */
+   private final List<String> metaDataLocations = new ArrayList<String>();
+   
+   /** The class path entries. */
+   private final List<String> classPathEntries = new ArrayList<String>();
+   
+   /** The child contexts. */
+   private final List<VirtualDeploymentAssemblyContext> childs = new ArrayList<VirtualDeploymentAssemblyContext>();
+ 
+   protected List<String> getClassPathLocations()
+   {
+      return this.classPathEntries;
+   }
+   
+   protected List<String> getMetaDataLocations()
+   {
+      return this.metaDataLocations;
+   }
+   
+   protected List<VirtualDeploymentAssemblyContext> getChildren()
+   {
+      return this.childs;
+   }
+   
+   protected void addClassPathEntry(String entry)
+   {
+      if(entry != null)
+         getClassPathLocations().add(entry);
+   }
+   
+   protected void addClassEntries(List<String> entries)
+   {
+      if(entries != null && entries.isEmpty() == false)
+      {
+         getClassPathLocations().addAll(entries);
+      }
+   }
+   
+   protected void addMetaDataLocation(String location)
+   {
+      if(location != null)
+         getMetaDataLocations().add(location);
+   }
+   
+   protected void addMetaDataLocations(List<String> locations)
+   {
+      if(locations != null && locations.isEmpty() == false)
+      {
+         getMetaDataLocations().addAll(locations);
+      }
+   }
+   
+   protected void addChild(VirtualDeploymentAssemblyContext ctx)
+   {
+      if(ctx != null)
+         getChildren().add(ctx);
+   }
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/AbstractVirtualDeploymentAssembly.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,219 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.assembly;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.jboss.profileservice.spi.virtual.ClassPathLocation;
+import org.jboss.profileservice.spi.virtual.MetaDataLocation;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
+
+
+/**
+ * The virtual deployment builder assembles a VirtualFile
+ * based on the VirtualDeployment meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractVirtualDeploymentAssembly
+{
+   
+   /** The assembled context factory. */
+   private final AssembledContextFactory assemblyFactory = AssembledContextFactory.getInstance();
+
+   /**
+    * Assemble a virtual deployment.
+    * 
+    * @param deployment the virtual deployment
+    * @return the assembled directory
+    * @throws IOException
+    */
+   protected VirtualDeploymentAssemblyContext assemble(VirtualDeployment deployment) throws IOException
+   {
+      if(deployment == null)
+         throw new IllegalArgumentException("null virtual deployment");
+      if(deployment.getName() == null)
+         throw new IllegalArgumentException("null virtual deployment name");
+
+      // Create the deployment assembly context
+      VirtualDeploymentAssemblyContext ctx = createAssemblyContext(deployment);
+      // Process the virtual deployment
+      assemble(ctx, deployment);
+      //
+      return ctx;
+   }
+   
+   /**
+    * Assemble the virtual deployment context. Process sub contexts,
+    * add meta data and class path locations.
+    * 
+    * @param ctx the virtual deployment assembly context
+    * @param deployment the virtual deployment meta data
+    * @throws IOException
+    */
+   protected void assemble(VirtualDeploymentAssemblyContext ctx, VirtualDeployment deployment) throws IOException
+   {
+      if(deployment.getMetaDataLocations() != null && deployment.getMetaDataLocations().isEmpty() == false)
+      {
+         for(MetaDataLocation location : deployment.getMetaDataLocations())
+            ctx.addMetaDataLocation(location);
+      }
+      if(deployment.getClassPathLocations() != null && deployment.getClassPathLocations().isEmpty() == false)
+      {
+         for(ClassPathLocation location : deployment.getClassPathLocations())
+            ctx.addClassPathLocation(location);
+      }
+      if(deployment.getChildren() != null && deployment.getChildren().isEmpty() == false)
+      {
+         for(VirtualDeployment child : deployment.getChildren())
+         {
+            VirtualDeploymentAssemblyContext childCtx = ctx.addChild(child);
+            assemble(childCtx, child);
+         }
+      }
+   }
+   
+   /**
+    * Create the deployment name for assembled deployments.
+    * 
+    * @param deployment the virtual deployment meta data
+    * @return the deployment name
+    */
+   protected String createDeploymentName(VirtualDeployment deployment)
+   {
+      return deployment.getName() + System.currentTimeMillis();
+   }
+
+   /**
+    * Create a virtual deployment assembly context.
+    * 
+    * @param deployment the virtual deployment meta data
+    * @return the virtual deployment assembly context
+    * @throws IOException
+    */
+   protected VirtualDeploymentAssemblyContext createAssemblyContext(VirtualDeployment deployment) throws IOException
+   {
+      VirtualDeploymentAssemblyContext ctx = createNonAssembledContext(deployment);
+      if(ctx == null)
+      {
+         return assembleNewContext(deployment);
+      }
+      return ctx;
+   }
+   
+   /**
+    * Create a child assembly context.
+    * 
+    * @param deployment the virtual deployment child
+    * @param parent the assembled parent directory
+    * @return the child virtual deployment assembly context
+    * @throws IOException
+    */
+   protected VirtualDeploymentAssemblyContext createChildAssemblyContext(VirtualDeployment deployment, AssembledDirectory parent) throws IOException
+   {
+      VirtualDeploymentAssemblyContext ctx = createNonAssembledContext(deployment);
+      if(ctx == null)
+      {
+         AssembledDirectory root = parent.mkdir(deployment.getName());
+         return createAssemblyContext(root);         
+      }
+      return ctx;
+   }
+   
+   /**
+    * Assemble a new virtual deployment context.
+    * 
+    * @param deployment the virtual deployment meta data
+    * @return the virtual deployment assembly context
+    */
+   protected VirtualDeploymentAssemblyContext assembleNewContext(VirtualDeployment deployment)
+   {
+      // Create assembled directory
+      String fileName = createDeploymentName(deployment);
+      // Create the assembled directory
+      AssembledDirectory root = assemblyFactory.create(fileName, deployment.getName());
+      // Create the assembly context
+      return createAssemblyContext(root); 
+   }
+
+   /**
+    * Create the assembly context.
+    * 
+    * @param root the assembled root directory
+    * @return the virtual deployment assembly context
+    */
+   protected VirtualDeploymentAssemblyContext createAssemblyContext(AssembledDirectory root)
+   {
+      return new BasicVirtualAssemblyContext(root, this);
+   }
+
+   /**
+    * Create a Non assembled context, just based on a existing
+    * virtual file.
+    * 
+    * @param deployment the virtual deployment meta data
+    * @return the static assembly context
+    * @throws IOException
+    */
+   protected VirtualDeploymentAssemblyContext createNonAssembledContext(VirtualDeployment deployment) throws IOException
+   {
+      if(deployment.getPath() != null)
+      {
+         VirtualFile vf = getVirtualFile(deployment.getPath());
+         return new ImmutableAssemblyContext(vf);         
+      }
+      return null;
+   }
+   
+   /**
+    * Get a VirtualFile root.
+    * 
+    * @param url string representation of the URL
+    * @return the virtual file
+    * @throws IOException
+    */
+   protected VirtualFile getVirtualFile(String url) throws IOException
+   {
+      URL rootURL = new URL(url);
+      return getVirtualFile(rootURL);
+   }
+   
+   /**
+    * Get a VirtualFile root.
+    * 
+    * @param rootURL the root URL
+    * @return the virtual file
+    * @throws IOException
+    */
+   protected VirtualFile getVirtualFile(URL rootURL) throws IOException
+   {
+      return VFS.getRoot(rootURL);
+   }
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/BasicVirtualAssemblyContext.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,251 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.assembly;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.profileservice.spi.virtual.ClassPathLocation;
+import org.jboss.profileservice.spi.virtual.MetaDataLocation;
+import org.jboss.profileservice.spi.virtual.PathRestriction;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.profileservice.spi.virtual.VirtualPathMetaData;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class BasicVirtualAssemblyContext extends AbstractVirtualAssemblyContext 
+   implements VirtualDeploymentAssemblyContext
+{
+   
+   /** The assembled directory. */
+   private final AssembledDirectory root;
+
+   /** The virtual deployment assembly. */
+   private final AbstractVirtualDeploymentAssembly assembly;
+   
+   public BasicVirtualAssemblyContext(AssembledDirectory root, AbstractVirtualDeploymentAssembly assembly)
+   {
+      if(root == null)
+      {
+         throw new IllegalArgumentException("null root");
+      }
+      if(assembly == null)
+      {
+         throw new IllegalArgumentException("null assembly");
+      }
+      this.root = root;
+      this.assembly = assembly;
+   }
+   
+   @Override
+   public AssembledDirectory getRoot()
+   {
+      return this.root;
+   }
+   
+   @Override
+   public void addChild(VirtualFile vf)
+   {
+      if(vf == null)
+      {
+         throw new IllegalArgumentException("null virtual file");
+      }
+      getRoot().addChild(vf);
+   }
+
+   @Override
+   public void addChild(VirtualFile vf, String name)
+   {
+      if(vf == null)
+      {
+         throw new IllegalArgumentException("null virtual file");
+      }
+      getRoot().addChild(vf, name);
+   }
+   
+   @Override
+   public VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException
+   {
+      if(child == null)
+      {
+         throw new IllegalArgumentException("null virtual deployment");
+      }
+      if(child.getName() == null)
+      {
+         throw new IllegalArgumentException("null virtual deployment name");
+      }
+      // Create a child context
+      VirtualDeploymentAssemblyContext ctx = assembly.createChildAssemblyContext(child, getRoot());
+      addChild(ctx);
+      return ctx;
+   }
+
+   @Override
+   public void addPath(VirtualFile vf) throws IOException 
+   {
+      if(vf == null)
+      {
+         throw new IllegalArgumentException("null virtual file");
+      }
+      getRoot().addPath(vf);  
+   }
+
+   @Override
+   public void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException
+   {
+      if(vf == null)
+      {
+         throw new IllegalArgumentException("null virtual file");
+      }
+      getRoot().addPath(vf, filter);
+   }
+
+   @Override
+   public void addClassPathLocation(ClassPathLocation location) throws IOException
+   {
+      if(location == null)
+      {
+         throw new IllegalArgumentException("null class path location");
+      }
+      VirtualFile vf = createPath(location);
+      getClassPathLocations().addAll(addVirtualPath(vf, location));      
+   }
+
+   @Override
+   public void addMetaDataLocation(MetaDataLocation location) throws IOException
+   {
+      if(location == null)
+      {
+         throw new IllegalArgumentException("null meta data location");
+      }
+      VirtualFile vf = createPath(location);
+      getMetaDataLocations().addAll(addVirtualPath(vf, location));
+   }   
+   
+   protected VirtualFile createPath(VirtualPathMetaData path) throws IOException
+   {
+      VirtualFile file = getRoot().getChild(path.getPath());
+      if(file == null)
+      {
+         file = assembly.getVirtualFile(path.getPath());
+      }
+      return file;
+   }
+   
+   protected Collection<String> addVirtualPath(VirtualFile location, VirtualPathMetaData path) throws IOException
+   {
+      if(location.isLeaf())
+      {
+         getRoot().addChild(location, location.getName());
+         return Collections.singleton(location.getName());
+      }
+      else
+      {
+         return addVirtualPath(location, path.getIncludes(), path.getExcludes());
+      }
+   }
+   
+   /**
+    * Visit a virtual file and add the children based on includes, excludes.
+    * 
+    * The used filer is similar to the one used in the AssembledDirectory, except that not
+    * defined includes mean we accept everything.
+    * 
+    * @param location the file to visit
+    * @param includes the includes
+    * @param excludes the excludes
+    * @param the relative path names
+    * @throws IOException
+    */
+   protected Collection<String> addVirtualPath(final VirtualFile location, final Collection<PathRestriction> includes,
+         final Collection<PathRestriction> excludes) throws IOException
+   {
+      final List<String> included = new ArrayList<String>();
+      // Create the filter
+      final VirtualFileFilter recurseFilter = new VirtualFileFilter()
+      {
+         public boolean accepts(VirtualFile file)
+         {
+            boolean matched = false;
+            String path = file.getPathName();
+            if(includes == null || includes.isEmpty())
+            {
+               // if not defined we match all
+               matched = true;
+            }
+            else
+            {
+               for (PathRestriction include : includes)
+               {
+                  if (include.matches(path))
+                  {
+                     matched = true;
+                     break;
+                  }
+               }
+            }
+            if (matched == false)
+               return false;
+            if (excludes != null && excludes.isEmpty() == false)
+            {
+               for (PathRestriction exclude : excludes)
+               {
+                  if (exclude.matches(path))
+                     return false;
+               }
+            }
+            return true;
+         }
+      };
+      
+      // Why is this not working?
+      // assembled.addPath(root, recurseFilter);
+      
+      // This should not be here
+      VisitorAttributes va = new VisitorAttributes();
+      va.setLeavesOnly(true);
+      
+      FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(recurseFilter, va);
+      location.visit(visitor);
+      List<VirtualFile> files = visitor.getMatched();
+      for (VirtualFile vf : files)
+      {
+         getRoot().mkdirs(vf.getPathName()).addChild(vf);
+         included.add(vf.getPathName());
+      }
+      
+      return included; 
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/ImmutableAssemblyContext.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.assembly;
+
+import java.io.IOException;
+
+import org.jboss.profileservice.spi.virtual.ClassPathLocation;
+import org.jboss.profileservice.spi.virtual.MetaDataLocation;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * A immutable virtual deployment assembly context, which is not based on
+ * a assembled directory but on a virtual file. This only supports adding
+ * relative meta data and class path locations.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ImmutableAssemblyContext extends AbstractVirtualAssemblyContext
+   implements VirtualDeploymentAssemblyContext
+{
+
+   /** The root. */
+   private final VirtualFile root;
+
+   public ImmutableAssemblyContext(VirtualFile root)
+   {
+      if(root == null)
+      {
+         throw new IllegalArgumentException("null root");
+      }
+      this.root = root;
+   }
+   
+   @Override
+   public VirtualFile getRoot()
+   {
+      return this.root;
+   }
+
+   @Override
+   public void addClassPathLocation(ClassPathLocation location) throws IOException
+   {
+      if(location == null)
+      {
+         throw new IllegalArgumentException("null class path location");
+      }
+      addClassPathEntry(location.getPath());
+   }
+
+   @Override
+   public void addMetaDataLocation(MetaDataLocation location) throws IOException
+   {
+      if(location == null)
+      {
+         throw new IllegalArgumentException("null meta data location");
+      }
+      addMetaDataLocation(location.getPath());
+   }
+
+   @Override
+   public void addChild(VirtualFile vf) throws IOException
+   {
+      throw new IllegalStateException("cannot add a virtual file to a non-assembled context");  
+   }
+
+   @Override
+   public void addChild(VirtualFile vf, String name) throws IOException
+   {
+      throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
+   }
+
+   @Override
+   public void addPath(VirtualFile vf) throws IOException
+   {
+      throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
+   }
+
+   @Override
+   public void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException
+   {
+      throw new IllegalStateException("cannot add a virtual file to a non-assembled context");
+   }
+
+   @Override
+   public VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException
+   {
+      throw new IllegalStateException("cannot add a child to a non-assembled context");
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/assembly/StructureMetaDataBuilder.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.assembly;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.deployers.client.spi.Deployment;
+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.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.virtual.assembly.VirtualDeploymentAssemblyContext;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class StructureMetaDataBuilder
+{
+
+   /** The deployment factory. */
+   private static final DeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+   
+   public Deployment processDeployment(ProfileDeployment deployment, Deployment target)
+   {
+      // Get the assembly context
+      VirtualDeploymentAssemblyContext ctx = deployment.getAttachment(
+            VirtualDeploymentAssemblyContext.class.getName(), VirtualDeploymentAssemblyContext.class);
+      
+      // Create the stucture meta data
+      if(ctx != null)
+         createStructureMetaData(target, "", ctx);
+      
+      return target;
+   }
+   
+   protected ContextInfo createStructureMetaData(Deployment deployment, String path, VirtualDeploymentAssemblyContext ctx)
+   {
+      if(ctx instanceof BasicVirtualAssemblyContext)
+         return createStructureMetaData(deployment, path, (BasicVirtualAssemblyContext) ctx);
+      
+      return null;
+   }
+   
+   protected ContextInfo createStructureMetaData(Deployment deployment, String path, BasicVirtualAssemblyContext ctx)
+   {
+      List<String> metaDataLocations = getMetaDataLocations(ctx);
+      List<ClassPathEntry> classPathEntries = getClassPathEntries(ctx);
+      
+      ContextInfo info = deploymentFactory.addContext(deployment, path, metaDataLocations, classPathEntries);
+
+      if(ctx.getChildren() != null && ctx.getChildren().isEmpty() == false)
+      {
+         for(VirtualDeploymentAssemblyContext child : ctx.getChildren())
+         {
+            String childPath = child.getRoot().getName();
+            createStructureMetaData(deployment, childPath, child);
+         }
+      }
+      
+      return info;
+   }
+   
+   protected List<String> getMetaDataLocations(BasicVirtualAssemblyContext ctx)
+   {
+      return ctx.getMetaDataLocations();
+   }
+   
+   protected List<ClassPathEntry> getClassPathEntries(BasicVirtualAssemblyContext ctx)
+   {
+      List<ClassPathEntry> entries = new ArrayList<ClassPathEntry>();
+      if(ctx.getClassPathLocations() != null && ctx.getClassPathLocations().isEmpty() == false)
+      {
+         for(String s : ctx.getClassPathLocations())
+            entries.add(VFSDeploymentFactory.createClassPathEntry(s));
+      }
+      return entries;
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualDeployment.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,182 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.deployment;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.spi.virtual.ClassPathLocation;
+import org.jboss.profileservice.spi.virtual.MetaDataLocation;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+
+/**
+ * The virtual deployment meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(propOrder = {"name", "path", "metaDataLocations", "classPathLocations", "children" })
+public class AbstractVirtualDeployment implements VirtualDeployment
+{
+
+   /** The name. */
+   private String name;
+   
+   /** The path. */
+   private String path;
+   
+   /** The meta data locations. */
+   private List<MetaDataLocation> metaDataLocations;
+
+   /** The class path locations. */
+   private List<ClassPathLocation> classPathLocations;
+   
+   /** The child deployments. */
+   private List<VirtualDeployment> children;
+
+   public AbstractVirtualDeployment()
+   {
+
+   }
+   
+   public AbstractVirtualDeployment(String name)
+   {
+      this.name = name;
+   }
+   
+   /**
+    * Get the name.
+    * 
+    * @return the name.
+    */
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return name;
+   }
+
+   /**
+    * Set the name.
+    * 
+    * @param name The name to set.
+    */
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+   /**
+    * Get the path.
+    * 
+    * @return the path.
+    */
+   @XmlAttribute(name = "path")
+   public String getPath()
+   {
+      return path;
+   }
+
+   /**
+    * Set the path.
+    * 
+    * @param path The path to set.
+    */
+   public void setPath(String path)
+   {
+      this.path = path;
+   }
+
+   /**
+    * Get the metaDataLocations.
+    * 
+    * @return the metaDataLocations.
+    */
+   @XmlElement(name = "meta-inf", type = MetaDataLocationMetaData.class)
+   public List<MetaDataLocation> getMetaDataLocations()
+   {
+      return metaDataLocations;
+   }
+
+   /**
+    * Set the metaDataLocations.
+    * 
+    * @param metaDataLocations The metaDataLocations to set.
+    */
+   public void setMetaDataLocations(List<MetaDataLocation> metaDataLocations)
+   {
+      this.metaDataLocations = metaDataLocations;
+   }
+
+   /**
+    * Get the classPathLocations.
+    * 
+    * @return the classPathLocations.
+    */
+   @XmlElement(name = "classpath", type = ClassPathLocationMetaData.class)
+   public List<ClassPathLocation> getClassPathLocations()
+   {
+      return classPathLocations;
+   }
+
+   /**
+    * Set the classPathLocations.
+    * 
+    * @param classPathLocations The classPathLocations to set.
+    */
+   public void setClassPathLocations(List<ClassPathLocation> classPathLocations)
+   {
+      this.classPathLocations = classPathLocations;
+   }
+
+   /**
+    * Get the children.
+    * 
+    * @return the children.
+    */
+   @XmlElement(name = "virtual-deployment", type = AbstractVirtualDeployment.class)
+   public List<VirtualDeployment> getChildren()
+   {
+      return children;
+   }
+
+   /**
+    * Set the children.
+    * 
+    * @param children The children to set.
+    */
+   public void setChildren(List<VirtualDeployment> children)
+   {
+      this.children = children;
+   }
+
+   String checkName()
+   {
+      if(getName() == null)
+         throw new IllegalStateException("null virtual deployment name");
+      return getName();
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualPath.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualPath.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AbstractVirtualPath.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.deployment;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.spi.virtual.PathRestriction;
+import org.jboss.profileservice.spi.virtual.VirtualPathMetaData;
+
+/**
+ * The abstract virtual file set.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(propOrder = { "path", "includes", "excludes" })
+public class AbstractVirtualPath implements VirtualPathMetaData
+{
+
+   /** The path. */
+   private String path;
+
+   /** The includes. */
+   private List<PathRestriction> includes;
+   
+   /** The excludes. */
+   private List<PathRestriction> excludes;
+
+   public AbstractVirtualPath()
+   {
+      //
+   }
+   
+   public AbstractVirtualPath(String path)
+   {
+      this.path = path;
+   }
+   
+   /**
+    * Get the path.
+    * 
+    * @return the path
+    */
+   @XmlAttribute(name = "path")
+   public String getPath()
+   {
+      return path;
+   }
+
+   /**
+    * Set the path.
+    * 
+    * @param path The path to set
+    */
+   public void setPath(String path)
+   {
+      this.path = path;
+   }
+
+   /**
+    * Get the includes.
+    * 
+    * @return the includes
+    */
+   @XmlElement(name = "include", type = AntMatchRestriction.class)
+   public List<PathRestriction> getIncludes()
+   {
+      return includes;
+   }
+
+   /**
+    * Set the includes.
+    * 
+    * @param includes The includes to set
+    */
+   public void setIncludes(List<PathRestriction> includes)
+   {
+      this.includes = includes;
+   }
+
+   /**
+    * Get the excludes.
+    * 
+    * @return the excludes
+    */
+   @XmlElement(name = "exclude", type = AntMatchRestriction.class)
+   public List<PathRestriction> getExcludes()
+   {
+      return excludes;
+   }
+
+   /**
+    * Set the excludes.
+    * 
+    * @param excludes The excludes to set
+    */
+   public void setExcludes(List<PathRestriction> excludes)
+   {
+      this.excludes = excludes;
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/AntMatchRestriction.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.deployment;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.profileservice.spi.virtual.PathRestriction;
+import org.jboss.virtual.AssembledDirectory;
+
+/**
+ * Basic ant match restriction for includes/excludes. 
+ * 
+ * This pattern follow the Ant file pattern matching syntax. 
+ * See ant.apache.org for more details.
+ * See AssembledDirectory.antMatch
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+ at XmlType(propOrder = "name")
+public class AntMatchRestriction implements PathRestriction
+{
+
+   /** The name. */
+   private String name;
+   
+   @XmlAttribute(name = "name")
+   public String getName()
+   {
+      return this.name;
+   }
+   
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+   
+   @Override
+   public boolean matches(String path)
+   {
+      return AssembledDirectory.antMatch(path, getName());
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/ClassPathLocationMetaData.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.deployment;
+
+import org.jboss.profileservice.spi.virtual.ClassPathLocation;
+
+/**
+ * The class path location meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ClassPathLocationMetaData extends AbstractVirtualPath implements ClassPathLocation
+{
+
+   public ClassPathLocationMetaData()
+   {
+      super();
+   }
+
+   public ClassPathLocationMetaData(String path)
+   {
+      super(path);
+   }
+}
+

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/virtual/deployment/MetaDataLocationMetaData.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.deployment;
+
+import org.jboss.profileservice.spi.virtual.MetaDataLocation;
+
+/**
+ * The meta data location meta data.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class MetaDataLocationMetaData extends AbstractVirtualPath implements MetaDataLocation
+{
+
+}
+

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/AbstractVirtualAssemblyTestCase.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.test;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.profileservice.repository.virtual.VirtualRepositoryMetaData;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.test.profileservice.ProfileServiceTestBase;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.builder.JBossXBBuilder;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public abstract class AbstractVirtualAssemblyTestCase extends ProfileServiceTestBase
+{
+   
+   protected void assertIncluded(VirtualFile vf, String... children) throws Exception
+   {
+      for(String child : children)
+         assertNotNull(child, vf.getChild(child));
+   }
+   
+   protected void asssertExcluded(VirtualFile vf, String... children) throws Exception
+   {
+      for(String child : children)
+         assertNull(child, vf.getChild(child));      
+   }
+   
+   protected Map<String, VirtualDeployment> mapDeployments(VirtualRepositoryMetaData metaData)
+   {
+      Map<String, VirtualDeployment> deployments = new HashMap<String, VirtualDeployment>();
+      for(VirtualDeployment deployment : metaData.getDeployments())
+         deployments.put(deployment.getName(), deployment);
+      return deployments;
+   }
+
+   protected <T> T unmarshal(String resource, Class<T> clazz) throws Exception
+   {
+      URL url = getClass().getResource(resource);
+      return unmarshal(url.openStream(), clazz);
+   }
+   
+   protected <T> T unmarshal(InputStream is, Class<T> clazz) throws Exception
+   {
+      Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+      return clazz.cast(unmarshaller.unmarshal(is, JBossXBBuilder.build(clazz)));
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/StructureMetaDataUnitTestCase.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.structure.ClassPathEntry;
+import org.jboss.deployers.spi.structure.ContextInfo;
+import org.jboss.deployers.spi.structure.StructureMetaData;
+import org.jboss.profileservice.deployers.VDFDeploymentBuilder;
+import org.jboss.profileservice.repository.ProfileDeploymentFactory;
+import org.jboss.profileservice.repository.virtual.VirtualRepositoryMetaData;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+
+/**
+ * Test StructureMetaData creation.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class StructureMetaDataUnitTestCase extends AbstractVirtualAssemblyTestCase
+{
+
+   private final ProfileDeploymentFactory profileDeploymentFactory = ProfileDeploymentFactory.getInstance();
+   private final VDFDeploymentBuilder mcDeploymentBuilder = VDFDeploymentBuilder.getInstance();
+   
+   public void test() throws Exception
+   {
+      // Set the jboss.deployment.resources
+      System.setProperty("jboss.deployment.resources", getClass().getResource(".").toExternalForm());
+    
+      // Ignore VFS archive stuff
+      JarUtils.clearSuffixes();
+      
+      // Get the repository meta data
+      VirtualRepositoryMetaData repository = unmarshal("repository.xml", VirtualRepositoryMetaData.class);
+      Map<String, VirtualDeployment> deployments = mapDeployments(repository);
+    
+      for(VirtualDeployment d : repository.getDeployments())
+      {
+         ProfileDeployment pd = profileDeploymentFactory.createDeployment(d);
+         Deployment mcd = mcDeploymentBuilder.createDeployment(pd);
+         getLog().debug(mcd.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class));
+      }
+      
+      // test.simple
+      VirtualDeployment simpleVD = deployments.get("simple.deployer");
+      ProfileDeployment simple = createProfileDeployment(simpleVD);
+      assertNull(createStructureMetaData(simple));
+      
+      // test.deployer
+      VirtualDeployment deployerVD = deployments.get("test.deployer");
+      ProfileDeployment deployer = createProfileDeployment(deployerVD);
+      StructureMetaData deployerStructure = createStructureMetaData(deployer);
+      assertNotNull("null deployer structure", deployerStructure);
+      assertMetaDataLocations(deployerStructure.getContext(""), new String[]
+         {"test.xml", "test1.xml", "include.xml"});
+      assertClassPathEntries(deployerStructure.getContext(""), new String[] 
+         {"deployer.jar", "fake.jar", "fake2.jar"});
+
+      // test deployment
+      VirtualDeployment deploymentVD = deployments.get("test-deployment");
+      ProfileDeployment deployment = createProfileDeployment(deploymentVD);
+      StructureMetaData deploymentStructure = createStructureMetaData(deployment);
+      assertNotNull("null deployment structure", deploymentStructure);
+      assertMetaDataLocations(deploymentStructure.getContext(""), new String[]
+         {"jboss-beans.xml"});
+      assertClassPathEntries(deploymentStructure.getContext(""),
+            new String[] {"deployment.jar"});
+      // Check sub deployment ctx
+      assertNotNull("test sub deployment", deploymentStructure.getContext("test-sub-deployment"));
+      assertMetaDataLocations(deploymentStructure.getContext("test-sub-deployment"),
+            new String[] {"jboss-beans.xml"});
+      assertClassPathEntries(deploymentStructure.getContext("test-sub-deployment"),
+            new String[] {"test.jar"});
+   }
+   
+   protected void assertMetaDataLocations(ContextInfo info, String... locations)
+   {
+      assertNotNull("null meta data path", info.getMetaDataPath());
+      List<String> metaDataLocations = Arrays.asList(locations);
+      assertEquals("same size", metaDataLocations.size(), info.getMetaDataPath().size());
+      assertTrue(info.getMetaDataPath().containsAll(metaDataLocations));
+   }
+   
+   protected void assertClassPathEntries(ContextInfo info, String... paths)
+   {
+      assertNotNull(info.getClassPath());
+      List<String> original = Arrays.asList(paths);
+      List<String> generated = new ArrayList<String>();
+      for(ClassPathEntry entry : info.getClassPath())
+         generated.add(entry.getPath());
+      assertEquals("same size", original.size(), generated.size());
+      assertTrue(generated.containsAll(original));
+   }
+   
+   protected ProfileDeployment createProfileDeployment(VirtualDeployment deployment) throws Exception
+   {
+      return profileDeploymentFactory.createDeployment(deployment);
+   }
+   
+   protected StructureMetaData createStructureMetaData(ProfileDeployment deployment)
+   {
+      // Create the MC deployment
+      Deployment mcD = mcDeploymentBuilder.createDeployment(deployment);
+      return mcD.getPredeterminedManagedObjects().getAttachment(StructureMetaData.class);
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/virtual/test/VirtualDeploymentAssemblyUnitTestCase.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.virtual.test;
+
+import java.util.Map;
+
+import org.jboss.profileservice.repository.ProfileDeploymentFactory;
+import org.jboss.profileservice.repository.virtual.VirtualRepositoryMetaData;
+import org.jboss.profileservice.spi.ProfileDeployment;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+
+/**
+ * Test virtual deployment assembly.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class VirtualDeploymentAssemblyUnitTestCase extends AbstractVirtualAssemblyTestCase
+{
+   
+   public void test() throws Exception
+   {
+      // Set the jboss.deployment.resources
+      System.setProperty("jboss.deployment.resources", getClass().getResource(".").toExternalForm());
+    
+      // Ignore VFS archive stuff
+      JarUtils.clearSuffixes();
+      
+      // Get the repository meta data
+      VirtualRepositoryMetaData repository = unmarshal("repository.xml", VirtualRepositoryMetaData.class);
+      Map<String, VirtualDeployment> deployments = mapDeployments(repository);
+
+      // Get the ProfileDeploymentFactory
+      ProfileDeploymentFactory factory = ProfileDeploymentFactory.getInstance();
+      
+      // Test simple.deployer
+      VirtualDeployment simpleVD = deployments.get("simple.deployer");
+      ProfileDeployment simple = factory.createDeployment(simpleVD);
+      assertFalse("root must be a non-assembled file", simple.getRoot() instanceof AssembledDirectory);
+      log.debug(simple.getRoot());
+      
+      // Test test.deployer
+      VirtualDeployment deployerVD = deployments.get("test.deployer");
+      ProfileDeployment deployer = factory.createDeployment(deployerVD);
+      assertTrue(deployer.getRoot() instanceof AssembledDirectory);
+      // Check meta data includes/excludes
+      assertIncluded(deployer.getRoot(), new String[] {
+         "test.xml", "test1.xml", "include.xml"});
+      asssertExcluded(deployer.getRoot(), new String[] {"exclude-beans.xml"});
+      // Check class path includes/excludes
+      assertIncluded(deployer.getRoot(), new String[] {
+         "deployer.jar", "fake.jar", "fake2.jar"});
+      asssertExcluded(deployer.getRoot(), new String[] {"bad.jar"});
+      log.debug(deployer.getRoot());
+      
+      // Test deployment
+      VirtualDeployment deploymentVD = deployments.get("test-deployment");
+      ProfileDeployment deployment = factory.createDeployment(deploymentVD);
+      assertTrue(deployment.getRoot() instanceof AssembledDirectory);
+      // Get sub deployment
+      VirtualFile subDeploymentRoot = deployment.getRoot().getChild("test-sub-deployment");
+      assertNotNull(subDeploymentRoot);
+      // Check the sub deployments files
+      assertIncluded(subDeploymentRoot, new String[] {"jboss-beans.xml", "test.jar"} );
+      log.debug(deployment.getRoot());
+      log.debug(subDeploymentRoot);
+   }
+   
+}
+

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml
===================================================================
--- projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml	                        (rev 0)
+++ projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/repository.xml	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<virtual-repository xmlns="urn:jboss:profileservice:virtual:repository:1.0">
+
+<!--
+	// VFS-roots/Properties should maybe be defined in the domain.xml ?
+	// At least jboss-xb could already replace those then
+	 
+	<vfs-root name="jboss.home" value="vfsfile:/home/jboss-jboss-6.x" />
+ 	<vfs-root name="jboss.lib" value="${jboss.home}/lib" />
+ 	<vfs-root name="jboss.common.lib" value="${jboss.home}/common/lib" /> 
+ 	<vfs-root name="jboss.server.home" value="${jboss.home}/server" />
+	<vfs-root name="jboss.deployment.resources" path="${jboss.home}/common/deployments" />
+ -->
+ 
+ 	<!-- The simple.deployer -->
+ 	<virtual-deployment name="simple.deployer" 
+	 	path="${jboss.deployment.resources}/simple-deployer-jboss-beans.xml" />
+ 
+ 	<!-- The test.depoyer -->
+	<virtual-deployment name="test.deployer">
+		<meta-inf path="${jboss.deployment.resources}/test.deployer/meta-inf" />
+		<meta-inf path="${jboss.deployment.resources}/test.deployer/meta-inf2">
+			<include name="*.xml" />
+			<exclude name="*-beans.xml" />
+		</meta-inf>
+		<classpath path="${jboss.deployment.resources}/test.deployer/deployer.jar" />
+		<classpath path="${jboss.deployment.resources}/test.deployer/lib">
+			<include name="*.jar" />
+			<exclude name="bad.jar" />
+		</classpath>
+				<!--
+		<requires name="simple.deployer" />
+		-->
+	</virtual-deployment>
+
+	<!-- A test deployment  -->
+	<virtual-deployment name="test-deployment">
+		<meta-inf path="${jboss.deployment.resources}/test-deployment/META-INF" />
+		<classpath path="${jboss.deployment.resources}/test-deployment/lib" />
+		<!--
+		<requires name="test.deployer" />
+		-->
+		<virtual-deployment name="test-sub-deployment">
+			<meta-inf path="${jboss.deployment.resources}/test-deployment/child/META-INF" />
+			<classpath path="${jboss.deployment.resources}/test-deployment/child/test.jar" />
+		</virtual-deployment>
+	</virtual-deployment>
+
+</virtual-repository>

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/simple-deployer-jboss-beans.xml
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/META-INF/jboss-beans.xml
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/child/META-INF/jboss-beans.xml
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/child/test.jar
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test-deployment/lib/deployment.jar
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/deployer.jar
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/bad.jar
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/fake.jar
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/lib/fake2.jar
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf/test.xml
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf/test1.xml
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf2/exclude-beans.xml
===================================================================

Added: projects/profileservice/trunk/core/src/test/resources/org/jboss/test/profileservice/virtual/test/test.deployer/meta-inf2/include.xml
===================================================================

Modified: projects/profileservice/trunk/sandbox/pom.xml
===================================================================
--- projects/profileservice/trunk/sandbox/pom.xml	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/sandbox/pom.xml	2009-08-19 09:31:21 UTC (rev 92566)
@@ -8,12 +8,49 @@
   <groupId>org.jboss.profileservice</groupId>
   <artifactId>jboss-profileservice-sandbox</artifactId>
   <version>1.0.0-SNAPSHOT</version>
-  <packaging>pom</packaging>
+  <packaging>jar</packaging>
   <name>JBoss ProfileService Sandbox</name>
   <url>http://www.jboss.org/jbossas</url>
   <description>JBoss ProfileService Sandbox</description>
 
   <dependencies>
+  
+ 	<dependency>
+		<groupId>junit</groupId>
+		<artifactId>junit</artifactId>
+		<scope>test</scope>
+	</dependency>
+  
+ 	<dependency>
+		<groupId>org.jboss.logging</groupId>
+		<artifactId>jboss-logging-log4j</artifactId>
+		<version>2.1.0.GA</version>
+	</dependency>
+  
+     <dependency>
+       <groupId>org.jboss.deployers</groupId>
+       <artifactId>jboss-deployers-vfs</artifactId>
+       <version>${version.org.jboss.deployers}</version>
+     </dependency>
+  
+ 	<dependency>
+		<groupId>org.jboss.profileservice</groupId>
+		<artifactId>jboss-profileservice-spi</artifactId>
+		<version>${project.parent.version}</version>
+	</dependency>
+
+ 	<dependency>
+		<groupId>org.jboss.profileservice</groupId>
+		<artifactId>jboss-profileservice-core</artifactId>
+		<version>${project.parent.version}</version>
+	</dependency>
+  
+	<dependency>
+		<groupId>org.jboss</groupId>
+		<artifactId>jboss-vfs</artifactId>
+		<version>${version.org.jboss.vfs}</version>
+	</dependency>
+	
   </dependencies>
   
 </project>

Added: projects/profileservice/trunk/sandbox/src/test/resources/log4j.properties
===================================================================
--- projects/profileservice/trunk/sandbox/src/test/resources/log4j.properties	                        (rev 0)
+++ projects/profileservice/trunk/sandbox/src/test/resources/log4j.properties	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,18 @@
+### ====================================================================== ###
+##                                                                          ##
+##  JBoss Bootstrap Log4j Configuration                                     ##
+##                                                                          ##
+### ====================================================================== ###
+
+### $Id: log4j.properties 71868 2008-04-10 02:14:32Z scott.stark at jboss.org $ ###
+
+log4j.rootCategory=DEBUG, CONSOLE
+log4j.org.jboss.util=TRACE
+log4j.org.jboss.profileservice=TRACE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=DEBUG
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
+log4j.appender.CONSOLE.org.jboss.xb.binding.parser.sax=INFO

Modified: projects/profileservice/trunk/spi/pom.xml
===================================================================
--- projects/profileservice/trunk/spi/pom.xml	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/spi/pom.xml	2009-08-19 09:31:21 UTC (rev 92566)
@@ -14,6 +14,31 @@
 	<url>http://www.jboss.org/jbossas</url>
 	<description>JBoss ProfileService SPI</description>
 
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>2.5</version>
+                <configuration>
+                    <doclet>net.gleamynode.apiviz.APIviz</doclet>
+                    <docletArtifact>
+                        <groupId>org.jboss.apiviz</groupId>
+                        <artifactId>apiviz</artifactId>
+                        <version>1.2.5.GA</version>
+                    </docletArtifact>
+                    <doctitle><![CDATA[ProfileService SPI ]]>${version}</doctitle>
+                    <header><![CDATA[ProfileService SPI ]]>${version}</header>
+                    <footer><![CDATA[ProfileService SPI ]]>${version}</footer>
+                    <bottom><![CDATA[<i>Copyright &#169; 2009 JBoss, a division of Red Hat, Inc.</i>]]></bottom>
+                    <links>
+                        <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
+                    </links>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
+
 	<dependencies>
 		<dependency>
 			<groupId>org.jboss.man</groupId>

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/DeploymentRepository.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -38,6 +38,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
+ at Deprecated
 public interface DeploymentRepository
 {
    /**

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileKey.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -29,13 +29,16 @@
  * The key for a Profile. It consists of the domain, server and name.
  * 
  * @author Scott.Stark at jboss.org
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
 public class ProfileKey
    implements Comparable<ProfileKey>, Serializable
 {
+
+   /** The serialVersionUID */
    private static final long serialVersionUID = 1;
-   
+
    /** The DEFAULT value for domain, server, name */
    public static final String DEFAULT = "default";
    
@@ -137,9 +140,9 @@
     */
    public boolean isDefaultKey()
    {
-      return DEFAULT.equalsIgnoreCase(domain)
-         && DEFAULT.equalsIgnoreCase(server)
-         && DEFAULT.equalsIgnoreCase(name);
+      return DEFAULT.equalsIgnoreCase(getDomain())
+         && DEFAULT.equalsIgnoreCase(getServer())
+         && DEFAULT.equalsIgnoreCase(getName());
    }
 
    /**
@@ -165,6 +168,8 @@
    
    public boolean equals(Object o)
    {
+      if(o == this)
+         return true;
       if(o instanceof ProfileKey)
          return compareTo((ProfileKey) o) == 0;
       return false;

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java	2009-08-19 09:07:48 UTC (rev 92565)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/helpers/AbstractProfileDeployment.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -50,6 +50,20 @@
    /** The transient attachments. */
    private transient Map<String, Object> transientAttachments = new ConcurrentHashMap<String, Object>();
    
+   protected AbstractProfileDeployment(String name)
+   {
+      if(name == null)
+      {
+         throw new IllegalArgumentException("null name");
+      }
+      name = name.trim();
+      if(name.length() == 0)
+      {
+         throw new IllegalArgumentException("empty name");
+      }
+      this.name = name;
+   }
+   
    /**
     * Get the vfs file name safely.
     * @see VFSDeployment
@@ -89,6 +103,10 @@
     */
    protected void setName(String name)
    {
+      if(name == null)
+      {
+         throw new IllegalArgumentException("null name");
+      }
       this.name = name;
    }
 
@@ -109,6 +127,10 @@
     */
    protected void setRoot(VirtualFile root)
    {
+      if(root == null)
+      {
+         throw new IllegalArgumentException("null root");
+      }
       this.root = root;
    }
    

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/ClassPathLocation.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/ClassPathLocation.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/ClassPathLocation.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual;
+
+/**
+ * A classpath location.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ClassPathLocation extends VirtualPathMetaData
+{
+   
+}
+

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/MetaDataLocation.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/MetaDataLocation.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/MetaDataLocation.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual;
+
+/**
+ * A meta data location.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface MetaDataLocation extends VirtualPathMetaData
+{
+
+}
+

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/PathRestriction.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/PathRestriction.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/PathRestriction.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface PathRestriction
+{
+
+   /**
+    * Matches a path. 
+    * 
+    * @param path
+    * @return
+    */
+   boolean matches(String path);
+   
+}
+

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualDeployment.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualDeployment.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualDeployment.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual;
+
+import java.util.List;
+
+
+/**
+ * The virtual deployment.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface VirtualDeployment
+{
+
+   /**
+    * Get the deployment name.
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   /**
+    * Get the path of the virtual deployment.
+    * 
+    * @return the path
+    */
+   String getPath();
+   
+   /**
+    * Get the deployment's meta data locations. 
+    * 
+    * @return the meta data locations
+    */
+   List<MetaDataLocation> getMetaDataLocations();
+   
+   /**
+    * Get the deployment's classpath locations.
+    * 
+    * @return the classpath locations
+    */
+   List<ClassPathLocation> getClassPathLocations();
+   
+   /**
+    * Get the children.
+    * 
+    * @return the children
+    */
+   List<VirtualDeployment> getChildren();
+   
+}
+

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualPathMetaData.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualPathMetaData.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/VirtualPathMetaData.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual;
+
+import java.util.List;
+
+/**
+ * The virtual path meta data. 
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface VirtualPathMetaData
+{
+
+   /**
+    * The path.
+    * 
+    * @return the path
+    */
+   String getPath();
+   
+   /**
+    * Get the includes.
+    * 
+    * @return the includes
+    */
+   List<PathRestriction> getIncludes();
+   
+   /**
+    * Get the excludes.
+    * 
+    * @return the excludes
+    */
+   List<PathRestriction> getExcludes();
+   
+}
+

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualAssemblyContext.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual.assembly;
+
+import java.io.IOException;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileFilter;
+
+/**
+ * The virtual assembly context, used to assembly virtual deployments.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface VirtualAssemblyContext
+{
+
+   /**
+    * Get the context root.
+    * 
+    * @return the context root
+    */
+   VirtualFile getRoot();
+   
+   /**
+    * Add a child.
+    * 
+    * @param vf the virtual file
+    */
+   void addChild(VirtualFile vf) throws IOException;
+   
+   /**
+    * Add a child.
+    * 
+    * @param vf the virtual file
+    * @param name the new file name
+    */
+   void addChild(VirtualFile vf, String name) throws IOException;
+   
+   /**
+    * Recursively add a path.
+    * 
+    * @param vf the virtual file
+    */
+   void addPath(VirtualFile vf) throws IOException;
+   
+   /**
+    * Recursively add a path.
+    * 
+    * @param vf the virtual file
+    * @param filter the virtual file filter
+    */
+   void addPath(VirtualFile vf, VirtualFileFilter filter) throws IOException;
+   
+}
+

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssemblyContext.java	2009-08-19 09:31:21 UTC (rev 92566)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.profileservice.spi.virtual.assembly;
+
+import java.io.IOException;
+
+import org.jboss.profileservice.spi.virtual.ClassPathLocation;
+import org.jboss.profileservice.spi.virtual.MetaDataLocation;
+import org.jboss.profileservice.spi.virtual.VirtualDeployment;
+
+/**
+ * A virtual deployment context.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface VirtualDeploymentAssemblyContext extends VirtualAssemblyContext
+{
+
+   /**
+    * Add a class path location.
+    * 
+    * @param location the class path location
+    */
+   void addClassPathLocation(ClassPathLocation location) throws IOException;
+   
+   /**
+    * Add meta data location.
+    * 
+    * @param location the meta data location.
+    */
+   void addMetaDataLocation(MetaDataLocation location) throws IOException;
+   
+   
+   /**
+    * Add a child deployment context.
+    * 
+    * @param child the virtual deployment child
+    */
+   VirtualDeploymentAssemblyContext addChild(VirtualDeployment child) throws IOException;
+   
+}
+




More information about the jboss-cvs-commits mailing list