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 06:59:54 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/repository AbstractArtifact.java
jvanzyl 2002/12/08 21:59:54
Modified: src/java/org/apache/maven/repository AbstractArtifact.java
Log:
refactoring
Revision Changes Path
1.10 +47 -18 jakarta-turbine-maven/src/java/org/apache/maven/repository/AbstractArtifact.java
Index: AbstractArtifact.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/repository/AbstractArtifact.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AbstractArtifact.java 4 Dec 2002 07:01:15 -0000 1.9
+++ AbstractArtifact.java 9 Dec 2002 05:59:54 -0000 1.10
@@ -75,44 +75,73 @@
/** Dependency this artifact is based on. */
private Dependency dependency;
- /**
- * Set the dependency for this JAR artifact.
- *
- * @param dependency Dependency this artifact is based on.
- */
+
+ /** Path to artifact. */
+ private String path;
+
+ /** Flag to indicate specific path has been specified for this artifact. */
+ private boolean useExplicitPath = false;
+
+ /** Default constructor. */
+ public AbstractArtifact( Dependency dependency )
+ {
+ this.dependency = dependency;
+ }
+
+ /** @see Artifact#setDependency */
public void setDependency( Dependency dependency )
{
this.dependency = dependency;
}
- /**
- * Get the dependency.
- *
- * @return The dependency this artifact is based on.
- */
+ /** @see Artifact#getDependency */
public Dependency getDependency()
{
return dependency;
}
+ /** @see Artifact#setPath */
+ public void setPath( String path )
+ {
+ this.path = path;
+ }
+
/** @see Artifact#getPath */
- public abstract String getPath();
+ public String getPath()
+ {
+ if ( path == null )
+ {
+ return generatePath();
+ }
+
+ return path;
+ }
+
+ /** @see Artifact#generatePath */
+ public abstract String generatePath();
/** @see Artifact#getUrlPath */
public abstract String getUrlPath();
- /** @see Artifact#getName */
- public abstract String getName();
+ /**
+ * Get the name of the artifact from the underlying dependency.
+ *
+ * @return The name of the underlying dependency.
+ */
+ public String getName()
+ {
+ return getDependency().getArtifact();
+ }
/** @see Artifact#exists */
- public boolean exists( File mavenRepoLocal )
+ public boolean exists()
{
- return getFile( mavenRepoLocal ).exists();
+ return getFile().exists();
}
/** @see Artifact#getFile */
- public File getFile( File mavenRepoLocal )
+ public File getFile()
{
- return new File( mavenRepoLocal, getPath() );
+ return new File( getPath() );
}
}