[jboss-cvs] JBossAS SVN: r97457 - in projects/profileservice/trunk: core/src/main/java/org/jboss/profileservice/repository/artifact/file and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 4 08:29:07 EST 2009


Author: emuckenhuber
Date: 2009-12-04 08:29:07 -0500 (Fri, 04 Dec 2009)
New Revision: 97457

Added:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractRepositoryId.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryId.java
Modified:
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java
   projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java
   projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java
   projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java
Log:
update id usage

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractArtifactRepository.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -28,6 +28,7 @@
 import org.jboss.profileservice.spi.repository.ArtifactId;
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
+import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
 import org.jboss.virtual.VFS;
 import org.jboss.virtual.VirtualFile;
 
@@ -38,11 +39,14 @@
 public abstract class AbstractArtifactRepository<T extends ArtifactId> implements ArtifactRepository<T>
 {
 
+   /** The id. */
+   private ArtifactRepositoryId identifier;
+   
    /** The repository configuration. */
-   private ArtifactRepositoryConfiguration configuration;
+   private final ArtifactRepositoryConfiguration configuration;
    
    /** The repository root. */
-   private VirtualFile repositoryRoot;
+   private final VirtualFile repositoryRoot;
    
    public AbstractArtifactRepository(String type, URI root) throws IOException
    {
@@ -51,7 +55,9 @@
          throw new IllegalArgumentException("null repository root.");
       }
       this.repositoryRoot = VFS.getRoot(root);
-      this.configuration = new BasicRepositoryConfiguration(type, root);
+      BasicRepositoryConfiguration configuration = new BasicRepositoryConfiguration(type, root);
+      this.configuration = configuration;
+      this.identifier = configuration;
    }
 
    public AbstractArtifactRepository(String type, VirtualFile root) throws IOException, URISyntaxException
@@ -61,17 +67,15 @@
          throw new IllegalArgumentException("null repository root.");
       }
       this.repositoryRoot = root;
-      this.configuration = new BasicRepositoryConfiguration(type, root.toURI());
+      BasicRepositoryConfiguration configuration = new BasicRepositoryConfiguration(type, root.toURI()); 
+      this.configuration = configuration;
+      this.identifier = configuration;
    }
    
-   public AbstractArtifactRepository(ArtifactRepositoryConfiguration configuration) throws IOException
+   @Override
+   public ArtifactRepositoryId getIdentifier()
    {
-      if(configuration == null)
-      {
-         throw new IllegalArgumentException("null repository configuration");
-      }
-      this.repositoryRoot = VFS.getRoot(configuration.getLocation());
-      this.configuration = configuration;
+      return this.identifier;
    }
    
    @Override
@@ -85,7 +89,6 @@
       return this.repositoryRoot;
    }
 
-   @Override
    public boolean isMutable()
    {
       return getConfiguration().isMutable();

Added: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractRepositoryId.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractRepositoryId.java	                        (rev 0)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/AbstractRepositoryId.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -0,0 +1,70 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.repository.artifact;
+
+import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class AbstractRepositoryId implements ArtifactRepositoryId
+{
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 6983571857334117945L;
+
+   /** The name. */
+   private final String name;
+   
+   /** The repository type. */
+   private final String type;
+
+   public AbstractRepositoryId(String name, String type)
+   {
+      if(name == null)
+      {
+         throw new IllegalArgumentException("null name");
+      }
+      if(type == null)
+      {
+         throw new IllegalArgumentException("null type");
+      }
+      this.name = name;
+      this.type = type;
+   }
+   
+   
+   @Override
+   public String getName()
+   {
+      return this.name;
+   }
+
+   @Override
+   public String getType()
+   {
+      return this.type;
+   }
+
+}
+

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/BasicRepositoryConfiguration.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -24,12 +24,13 @@
 import java.net.URI;
 
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
+import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
 
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public class BasicRepositoryConfiguration implements ArtifactRepositoryConfiguration
+public class BasicRepositoryConfiguration implements ArtifactRepositoryConfiguration, ArtifactRepositoryId
 {
 
    /** The serialVersionUID */
@@ -64,14 +65,8 @@
       this.mutable = mutable;
    }
    
-   public URI getLocation()
+   public String getName()
    {
-      return location;
-   }
-   
-   @Override
-   public String getGroup()
-   {
       return null;
    }
    
@@ -80,6 +75,11 @@
       return type;
    }
    
+   public URI getLocation()
+   {
+      return location;
+   }
+   
    public boolean isMutable()
    {
       return mutable;

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/artifact/file/FileArtifactId.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -35,6 +35,9 @@
 public class FileArtifactId extends AbstractArtifactId
 {
    
+   /** The serialVersionUID */
+   private static final long serialVersionUID = 5979865973627325317L;
+
    /** An empty artifact. */
    public final static ArtifactId EMPTY_ARTIFACT = new FileArtifactId();
    

Modified: projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/core/src/main/java/org/jboss/profileservice/repository/virtual/VirtualDeploymentRepository.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -96,11 +96,11 @@
    {
       if(repository == null)
          throw new IllegalArgumentException("null repository");
-      if(repository.getConfiguration() == null)
+      if(repository.getIdentifier() == null)
          throw new IllegalArgumentException("null repository configuration");
-      if(repository.getConfiguration().getType() == null)
+      if(repository.getIdentifier().getType() == null)
          throw new IllegalArgumentException("null repository configuration type");
-      addRepository(repository.getConfiguration().getType(), repository);
+      addRepository(repository.getIdentifier().getType(), repository);
    }
    
    public void addRepository(String type, ArtifactRepository<ArtifactId> repository)
@@ -112,11 +112,11 @@
    {
       if(repository == null)
          throw new IllegalArgumentException("null repository");
-      if(repository.getConfiguration() == null)
+      if(repository.getIdentifier() == null)
          throw new IllegalArgumentException("null repository configuration");
-      if(repository.getConfiguration().getType() == null)
+      if(repository.getIdentifier().getType() == null)
          throw new IllegalArgumentException("null repository configuration type");
-      removeRepository(repository.getConfiguration().getType(), repository);
+      removeRepository(repository.getIdentifier().getType(), repository);
    }
    
    public void removeRepository(String type, ArtifactRepository<ArtifactId> repository)

Modified: projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/core/src/test/java/org/jboss/test/profileservice/support/NoopArtifactRepository.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -28,6 +28,7 @@
 import org.jboss.profileservice.spi.repository.ArtifactId;
 import org.jboss.profileservice.spi.repository.ArtifactRepository;
 import org.jboss.profileservice.spi.repository.ArtifactRepositoryConfiguration;
+import org.jboss.profileservice.spi.repository.ArtifactRepositoryId;
 import org.jboss.virtual.VirtualFile;
 
 /**
@@ -38,6 +39,12 @@
 {
 
    @Override
+   public ArtifactRepositoryId getIdentifier()
+   {
+      return null;
+   }
+   
+   @Override
    public boolean containsArtifact(ArtifactId artifact)
    {
       return false;
@@ -67,11 +74,5 @@
       return null;
    }
 
-   @Override
-   public boolean isMutable()
-   {
-      return false;
-   }
-
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/ProfileDeployment.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -32,6 +32,8 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
+// TODO remove dependency on VFS
+// TODO extends VirtualDeployment ?
 public interface ProfileDeployment extends Serializable
 {
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Artifact.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -28,15 +28,8 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public interface Artifact<T extends ArtifactId>
+public interface Artifact<T extends ArtifactId> extends Identifiable<T> 
 {
-
-   /**
-    * Get the artifact id.
-    * 
-    * @return the identifier
-    */
-   T getIdentifier();
    
    /**
     * Get the last modified.

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactId.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -21,13 +21,15 @@
 */
 package org.jboss.profileservice.spi.repository;
 
+import java.io.Serializable;
+
 /**
  * The artifact identifier.
  * 
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public interface ArtifactId extends Identifiable
+public interface ArtifactId extends Serializable
 {
 
    /**

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepository.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -32,7 +32,7 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public interface ArtifactRepository<T extends ArtifactId> extends Identifiable
+public interface ArtifactRepository<T extends ArtifactId> extends Identifiable<ArtifactRepositoryId>
 {
    
    /**
@@ -73,13 +73,8 @@
     * @return the virtual file
     * @throws IOException
     */
+   // TODO remove dependency on VFS ? 
    VirtualFile getArtifactFile(T artifact) throws IOException;
-   
-   /**
-    * Is mutable.
-    * 
-    * @return isMutable
-    */
-   boolean isMutable();
+
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryConfiguration.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -21,7 +21,6 @@
 */
 package org.jboss.profileservice.spi.repository;
 
-import java.io.Serializable;
 import java.net.URI;
 
 /**
@@ -30,24 +29,10 @@
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public interface ArtifactRepositoryConfiguration extends Serializable
+public interface ArtifactRepositoryConfiguration
 {
-  
-   /**
-    * Get the repository type.
-    * 
-    * @return the repository type
-    */
-   String getType();
    
    /**
-    * Get the group. 
-    * 
-    * @return the group
-    */
-   String getGroup();
-   
-   /**
     * Get the repository location. 
     * 
     * @return the location

Added: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryId.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryId.java	                        (rev 0)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/ArtifactRepositoryId.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.profileservice.spi.repository;
+
+import java.io.Serializable;
+
+/**
+ * The artifact repository id.
+ * 
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+// TODO make this a unique identifier for a artifact repo
+public interface ArtifactRepositoryId extends Serializable
+{
+
+   /**
+    * Get the repository type.
+    * 
+    * @return the repository type
+    */
+   String getType();
+   
+   /**
+    * Get the name.
+    * 
+    * @return the name
+    */
+   String getName();
+   
+   
+   // TODO relative url based on jboss home?
+   // String getRelativeLocation();
+}
+

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/repository/Identifiable.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -21,12 +21,21 @@
 */
 package org.jboss.profileservice.spi.repository;
 
+import java.io.Serializable;
+
 /**
  * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
  * @version $Revision$
  */
-public interface Identifiable
+public interface Identifiable<T extends Serializable>
 {
+   
+   /**
+    * Get the identifier
+    * 
+    * @return the identifier
+    */
+   T getIdentifier();
 
 }
 

Modified: projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java
===================================================================
--- projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java	2009-12-04 13:05:30 UTC (rev 97456)
+++ projects/profileservice/trunk/spi/src/main/java/org/jboss/profileservice/spi/virtual/assembly/VirtualDeploymentAssembly.java	2009-12-04 13:29:07 UTC (rev 97457)
@@ -40,6 +40,10 @@
     * @throws IOException
     */
    VirtualDeploymentAssemblyContext assemble(VirtualDeployment deployment) throws IOException;
+ 
    
+   // TODO disassemble a virtual deployment, updating the artifacts in a mutable repo
+   // void disassemble(VirtualDeployment deployment) throws IOException;
+   
 }
 




More information about the jboss-cvs-commits mailing list