From 41b3eb4635401b3b6631d938dc9c5ea686570e71 Mon Sep 17 00:00:00 2001 From: "Edwin L. Punzalan" Date: Mon, 13 Mar 2006 11:31:47 +0000 Subject: [PATCH] Added javadoc annotations git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@385518 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/repository/ArtifactUtils.java | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java b/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java index e302854f7..0a23da806 100644 --- a/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java +++ b/maven-repository-utils/src/main/java/org/apache/maven/repository/ArtifactUtils.java @@ -8,10 +8,10 @@ import org.codehaus.plexus.util.StringUtils; import java.io.File; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; -import java.util.LinkedList; -import java.util.Iterator; /* * Copyright 2005-2006 The Apache Software Foundation. @@ -30,10 +30,21 @@ import java.util.Iterator; */ /** + * Class used to build an artifact object based on a relative from a repository's basedir. + * * @author Edwin Punzalan */ public class ArtifactUtils { + /** + * Method used to build an artifact and then set its repository and file fields with the proper values + * + * @param repositoryBase the base directory of the repository + * @param path the path of the artifact relative from the repository base directory + * @param repository the repository where the artifact can be found + * @param artifactFactory the artifactFactory to build the Artifact object when the given path is a valid artifact path + * @return Artifact object if the given path represents an artifact path, otherwise, returns null + */ public static Artifact buildArtifact( File repositoryBase, String path, ArtifactRepository repository, ArtifactFactory artifactFactory ) { @@ -48,6 +59,13 @@ public class ArtifactUtils return artifact; } + /** + * Method used to build an artifact object using a relative path from a repository base directory. + * + * @param path the relative path of the artifact from a "default" ArtifactRepository's base directory + * @param artifactFactory the artifactFactory to build the Artifact object when the given path is a valid artifact path + * @return Artifact object if the given path represents an artifact path, otherwise, returns null + */ public static Artifact buildArtifact( String path, ArtifactFactory artifactFactory ) { List pathParts = new ArrayList(); @@ -182,8 +200,8 @@ public class ArtifactUtils else { classifier = remainingFilename.substring( version.length() + 1 ); - artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, - type, classifier ); + artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, + classifier ); } } else @@ -197,6 +215,16 @@ public class ArtifactUtils return artifact; } + /** + * Method used to build an artifact object using a relative path from a repository base directory. An artifactId + * having the words "DEV", "PRE", "RC", "ALPHA", "BETA", "DEBUG", "UNOFFICIAL", "CURRENT", "LATEST", "FCS", + * "RELEASE", "NIGHTLY", "SNAPSHOT" and "TEST" (not case-sensitive) will most likely make this method fail as + * they are reserved for version usage. + * + * @param path the relative path of the artifact from a "legacy" ArtifactRepository's base directory + * @param artifactFactory the artifactFactory to build the Artifact object when the given path is a valid artifact path + * @return Artifact object if the given path represents an artifact path, otherwise, returns null + */ public static Artifact buildArtifactFromLegacyPath( String path, ArtifactFactory artifactFactory ) { StringTokenizer tokens = new StringTokenizer( path, "/\\" ); @@ -408,7 +436,8 @@ public class ArtifactUtils { if ( classifierBuffer.length() > 0 ) { - result = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, + result = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, + type, classifierBuffer.toString() ); } else -- 2.39.5