aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-base/archiva-repository-layer
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-10-12 17:53:59 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-10-12 17:53:59 +0000
commitbaacf6e15f98f2638f198bbe072dfc782a296474 (patch)
tree490b73fcd93057ca62ea8d751f67fd25cfd786ef /archiva-base/archiva-repository-layer
parent8d21f6e627b25d5828843bb4fc9e360625c54280 (diff)
downloadarchiva-baacf6e15f98f2638f198bbe072dfc782a296474.tar.gz
archiva-baacf6e15f98f2638f198bbe072dfc782a296474.zip
Adding ManagedRepositoryContent.toFile( ArchivaArtifact ) and ManagedRepositoryContent.toPath( ArchivaArtifact )
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@584215 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-repository-layer')
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java29
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java13
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java12
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java6
-rw-r--r--archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java6
5 files changed, 60 insertions, 6 deletions
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
index 21a3b5fbc..ef1ff8d80 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/ManagedRepositoryContent.java
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.repository;
*/
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
@@ -101,7 +102,7 @@ public interface ManagedRepositoryContent
public ManagedRepositoryConfiguration getRepository();
/**
- * Given a specific ProjectReference, return the list of available versions for
+ * Given a specific {@link ProjectReference}, return the list of available versions for
* that project reference.
*
* @param reference the project reference to work off of.
@@ -114,7 +115,7 @@ public interface ManagedRepositoryContent
/**
* <p>
- * Given a specific VersionedReference, return the list of available versions for that
+ * Given a specific {@link VersionedReference}, return the list of available versions for that
* versioned reference.
* </p>
*
@@ -174,15 +175,23 @@ public interface ManagedRepositoryContent
throws LayoutException;
/**
- * Given an ArtifactReference, return the file reference to the artifact.
+ * Given an {@link ArtifactReference}, return the file reference to the artifact.
*
* @param reference the artifact reference to use.
* @return the relative path to the artifact.
*/
public File toFile( ArtifactReference reference );
+
+ /**
+ * Given an {@link ArchivaArtifact}, return the file reference to the artifact.
+ *
+ * @param reference the archiva artifact to use.
+ * @return the relative path to the artifact.
+ */
+ public File toFile( ArchivaArtifact reference );
/**
- * Given a project reference, return the path to the metadata for
+ * Given a {@link ProjectReference}, return the path to the metadata for
* the project.
*
* @param reference the reference to use.
@@ -191,7 +200,7 @@ public interface ManagedRepositoryContent
public String toMetadataPath( ProjectReference reference );
/**
- * Given a versioned reference, return the path to the metadata for
+ * Given a {@link VersionedReference}, return the path to the metadata for
* the specific version of the project.
*
* @param reference the reference to use.
@@ -200,10 +209,18 @@ public interface ManagedRepositoryContent
public String toMetadataPath( VersionedReference reference );
/**
- * Given an ArtifactReference, return the relative path to the artifact.
+ * Given an {@link ArtifactReference}, return the relative path to the artifact.
*
* @param reference the artifact reference to use.
* @return the relative path to the artifact.
*/
public String toPath( ArtifactReference reference );
+
+ /**
+ * Given an {@link ArchivaArtifact}, return the relative path to the artifact.
+ *
+ * @param reference the archiva artifact to use.
+ * @return the relative path to the artifact.
+ */
+ public String toPath( ArchivaArtifact reference );
}
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
index 30d54ec85..a1b4d78e7 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java
@@ -21,6 +21,7 @@ package org.apache.maven.archiva.repository.content;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.VersionUtil;
+import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
@@ -74,6 +75,18 @@ public abstract class AbstractDefaultRepositoryContent
return path.toString();
}
+
+ public String toPath( ArchivaArtifact reference )
+ {
+ if ( reference == null )
+ {
+ throw new IllegalArgumentException( "ArchivaArtifact cannot be null" );
+ }
+
+ String baseVersion = VersionUtil.getBaseVersion( reference.getVersion() );
+ return toPath( reference.getGroupId(), reference.getArtifactId(), baseVersion, reference.getVersion(),
+ reference.getClassifier(), reference.getType() );
+ }
public String toPath( ArtifactReference reference )
{
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java
index a9acaf2b9..33931a527 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java
@@ -20,6 +20,7 @@ package org.apache.maven.archiva.repository.content;
*/
import org.apache.commons.lang.StringUtils;
+import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.repository.layout.LayoutException;
@@ -55,6 +56,17 @@ public abstract class AbstractLegacyRepositoryContent
{
return LegacyPathParser.toArtifactReference( path );
}
+
+ public String toPath( ArchivaArtifact reference )
+ {
+ if ( reference == null )
+ {
+ throw new IllegalArgumentException( "Artifact reference cannot be null" );
+ }
+
+ return toPath( reference.getGroupId(), reference.getArtifactId(), reference.getVersion(), reference
+ .getClassifier(), reference.getType() );
+ }
public String toPath( ArtifactReference reference )
{
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
index 78ddfb2bd..9de5064e1 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java
@@ -23,6 +23,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.FileTypes;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
@@ -333,6 +334,11 @@ public class ManagedDefaultRepositoryContent
{
return new File( repository.getLocation(), toPath( reference ) );
}
+
+ public File toFile( ArchivaArtifact reference )
+ {
+ return new File( repository.getLocation(), toPath( reference ) );
+ }
/**
* Get the first Artifact found in the provided VersionedReference location.
diff --git a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
index 212aeed81..c1817af4c 100644
--- a/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
+++ b/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java
@@ -24,6 +24,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.PathUtil;
import org.apache.maven.archiva.configuration.FileTypes;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArtifactReference;
import org.apache.maven.archiva.model.ProjectReference;
import org.apache.maven.archiva.model.VersionedReference;
@@ -349,6 +350,11 @@ public class ManagedLegacyRepositoryContent
return super.toArtifactReference( path );
}
+
+ public File toFile( ArchivaArtifact reference )
+ {
+ return new File( repository.getLocation(), toPath( reference ) );
+ }
public File toFile( ArtifactReference reference )
{