You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2002/12/09 07:00:17 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/repository GenericArtifact.java
jvanzyl 2002/12/08 22:00:17
Modified: src/java/org/apache/maven/repository GenericArtifact.java
Log:
refactoring
Revision Changes Path
1.8 +9 -47 jakarta-turbine-maven/src/java/org/apache/maven/repository/GenericArtifact.java
Index: GenericArtifact.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/GenericArtifact.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- GenericArtifact.java 25 Nov 2002 19:20:49 -0000 1.7
+++ GenericArtifact.java 9 Dec 2002 06:00:17 -0000 1.8
@@ -58,8 +58,6 @@
import org.apache.maven.project.Dependency;
-import java.io.File;
-
/**
* Generic artifact that builds its path and url information based on its
* associated dependency. URLs are of the form "id/type/artifact".
@@ -71,17 +69,8 @@
public class GenericArtifact
extends AbstractArtifact
{
- /** Platform specific file separator used for file system operations. */
- private static final String ps = File.separator;
-
- /** Associated dependency. */
- private Dependency dependency;
-
- /** Path to the artifact. */
- private String path;
-
- /** URL of the artifact. */
- private String url;
+ /** Type */
+ private String typeDir;
/**
* Constructor for the GenericArtifact object
@@ -90,10 +79,7 @@
*/
public GenericArtifact( Dependency dependency )
{
- this.dependency = dependency;
- String projectId = dependency.getProjectId();
- String artifact = dependency.getArtifact();
- String typeDir;
+ super( dependency );
if ( dependency.isCompileType() || dependency.isTestType()
|| "jar".equals( dependency.getType() ) )
@@ -110,30 +96,16 @@
typeDir = "distributions";
}
}
- this.path = ps + projectId + ps + typeDir + ps + artifact;
- this.url = "/" + projectId + "/" + typeDir + "/" + artifact;
- }
-
- /**
- * Return the associated dependency of this artifact.
- *
- * @return Associated dependency.
- */
- public Dependency getDependency()
- {
- return this.dependency;
}
/**
- * Get the path of the artifact using platform specific naming conventions.
- * The path is derived from the underlying dependency in the form
- * "id/type/artifact".
+ * Generate the path to the artifact.
*
- * @return Path to the artifact.
+ * @return The generated path to the artifact.
*/
- public String getPath()
+ public String generatePath()
{
- return this.path;
+ return ps + getDependency().getGroupId() + ps + typeDir + ps + getDependency().getArtifact();
}
/**
@@ -144,16 +116,6 @@
*/
public String getUrlPath()
{
- return this.url;
- }
-
- /**
- * Get the name of the artifact from the underlying dependency.
- *
- * @return The name of the underlying dependency.
- */
- public String getName()
- {
- return this.dependency.getArtifact();
+ return "/" + getDependency().getProjectId() + "/" + typeDir + "/" + getDependency().getArtifact();
}
}