maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r618043 - in /maven/artifact/trunk/src: main/java/org/apache/maven/artifact/ main/java/org/apache/maven/artifact/deployer/ main/java/org/apache/maven/artifact/factory/ main/java/org/apache/maven/artifact/installer/ main/java/org/apache/mave...
Date Sun, 03 Feb 2008 17:46:26 GMT
Author: jvanzyl
Date: Sun Feb  3 09:46:23 2008
New Revision: 618043

URL: http://svn.apache.org/viewvc?rev=618043&view=rev
Log:
o rolling back to r614991

Modified:
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/Artifact.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/DefaultArtifact.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java
    maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java
    maven/artifact/trunk/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
    maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/Artifact.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/Artifact.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/Artifact.java (original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/Artifact.java Sun Feb  3
09:46:23 2008
@@ -119,6 +119,8 @@
 
     void setDependencyFilter( ArtifactFilter artifactFilter );
 
+    ArtifactHandler getArtifactHandler();
+
     List getDependencyTrail();
 
     void setDependencyTrail( List dependencyTrail );
@@ -142,6 +144,9 @@
     boolean isResolved();
 
     void setResolvedVersion( String version );
+
+    /** @todo remove, a quick hack for the lifecycle executor */
+    void setArtifactHandler( ArtifactHandler handler );
 
     boolean isRelease();
 

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ArtifactUtils.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ArtifactUtils.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ArtifactUtils.java (original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/ArtifactUtils.java Sun Feb
 3 09:46:23 2008
@@ -150,10 +150,10 @@
         {
             range = VersionRange.createFromVersion( artifact.getVersion() );
         }
-        
-        DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
range.cloneOf(),
-            artifact.getScope(), artifact.getType(), artifact.getClassifier(), artifact.isOptional()
);
 
+        DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
range.cloneOf(),
+            artifact.getScope(), artifact.getType(), artifact.getClassifier(),
+            artifact.getArtifactHandler(), artifact.isOptional() );
         clone.setRelease( artifact.isRelease() );
         clone.setResolvedVersion( artifact.getVersion() );
         clone.setResolved( artifact.isResolved() );

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/DefaultArtifact.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/DefaultArtifact.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/DefaultArtifact.java (original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/DefaultArtifact.java Sun
Feb  3 09:46:23 2008
@@ -37,7 +37,7 @@
 import java.util.regex.Matcher;
 
 /**
- * @author Jason van Zyl
+ * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  * @version $Id$
  * @todo this should possibly be replaced by type handler
  */
@@ -48,6 +48,13 @@
 
     private String artifactId;
 
+    /**
+     * The resolved version for the artifact after conflict resolution, that has not been
transformed.
+     *
+     * @todo should be final
+     */
+    private String baseVersion;
+
     private final String type;
 
     private final String classifier;
@@ -56,24 +63,15 @@
 
     private File file;
 
-    // Why is this here? What repository is determined at runtime and is therefore a
-    // runtime charactistic. This needs to go. jvz.
     private ArtifactRepository repository;
 
     private String downloadUrl;
 
-    // Why is this here? jvz.
     private ArtifactFilter dependencyFilter;
 
-    // Why is this here? jvz?
-    private List dependencyTrail;
+    private ArtifactHandler artifactHandler;
 
-    /**
-     * The resolved version for the artifact after conflict resolution, that has not been
transformed.
-     *
-     * @todo should be final
-     */
-    private String baseVersion;
+    private List dependencyTrail;
 
     private String version;
 
@@ -81,15 +79,12 @@
 
     private boolean resolved;
 
-    // This is specific to maven. jvz.
     private boolean release;
 
-    // If the version is stored here (above), why on earth do we store the available versions
here? jvz.
     private List availableVersions;
 
     private Map metadataMap;
 
-    // This is Maven specific. jvz/
     private boolean optional;
 
     public DefaultArtifact( String groupId,
@@ -97,9 +92,10 @@
                             VersionRange versionRange,
                             String scope,
                             String type,
-                            String classifier )
+                            String classifier,
+                            ArtifactHandler artifactHandler )
     {
-        this( groupId, artifactId, versionRange, scope, type, classifier, false );
+        this( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler,
false );
     }
 
     public DefaultArtifact( String groupId,
@@ -108,6 +104,7 @@
                             String scope,
                             String type,
                             String classifier,
+                            ArtifactHandler artifactHandler,
                             boolean optional )
     {
         this.groupId = groupId;
@@ -118,10 +115,17 @@
 
         selectVersionFromNewRangeIfAvailable();
 
+        this.artifactHandler = artifactHandler;
+
         this.scope = scope;
 
         this.type = type;
 
+        if ( classifier == null )
+        {
+            classifier = artifactHandler.getClassifier();
+        }
+
         this.classifier = classifier;
 
         this.optional = optional;
@@ -470,6 +474,11 @@
         dependencyFilter = artifactFilter;
     }
 
+    public ArtifactHandler getArtifactHandler()
+    {
+        return artifactHandler;
+    }
+
     public List getDependencyTrail()
     {
         return dependencyTrail;
@@ -552,6 +561,11 @@
     {
         this.version = version;
         // retain baseVersion
+    }
+
+    public void setArtifactHandler( ArtifactHandler artifactHandler )
+    {
+        this.artifactHandler = artifactHandler;
     }
 
     public void setRelease( boolean release )

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/deployer/DefaultArtifactDeployer.java
Sun Feb  3 09:46:23 2008
@@ -20,7 +20,6 @@
  */
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
@@ -64,9 +63,6 @@
     /** @plexus.requirement role-hint="default" */
     private ArtifactRepositoryLayout defaultLayout;
 
-    /** @plexus.requirement */
-    private ArtifactHandlerManager artifactHandlerManager;
-
     /** @deprecated we want to use the artifact method only, and ensure artifact.file is
set correctly. */
     public void deploy( String basedir,
                         String finalName,
@@ -75,8 +71,7 @@
                         ArtifactRepository localRepository )
         throws ArtifactDeploymentException
     {
-        String extension = artifactHandlerManager.getArtifactHandler( artifact.getType()
).getExtension();
-
+        String extension = artifact.getArtifactHandler().getExtension();
         File source = new File( basedir, finalName + "." + extension );
         deploy( source, artifact, deploymentRepository, localRepository );
     }

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/factory/DefaultArtifactFactory.java
Sun Feb  3 09:46:23 2008
@@ -211,6 +211,9 @@
             desiredScope = Artifact.SCOPE_SYSTEM;
         }
 
-        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type,
classifier, optional );
+        ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( type );
+
+        return new DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type,
classifier, handler,
+            optional );
     }
 }

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/installer/DefaultArtifactInstaller.java
Sun Feb  3 09:46:23 2008
@@ -20,7 +20,6 @@
  */
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataInstallationException;
@@ -47,9 +46,6 @@
     /** @plexus.requirement */
     private RepositoryMetadataManager repositoryMetadataManager;
 
-    /** @plexus.requirement */
-    private ArtifactHandlerManager artifactHandlerManager;
-    
     /** @deprecated we want to use the artifact method only, and ensure artifact.file is
set correctly. */
     public void install( String basedir,
                          String finalName,
@@ -57,8 +53,7 @@
                          ArtifactRepository localRepository )
         throws ArtifactInstallationException
     {
-        String extension = artifactHandlerManager.getArtifactHandler( artifact.getType()
).getExtension();
-
+        String extension = artifact.getArtifactHandler().getExtension();
         File source = new File( basedir, finalName + "." + extension );
 
         install( source, artifact, localRepository );

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
Sun Feb  3 09:46:23 2008
@@ -21,7 +21,6 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
@@ -38,12 +37,9 @@
 
     private static final char ARTIFACT_SEPARATOR = '-';
 
-    /** @plexus.requirement */
-    private ArtifactHandlerManager artifactHandlerManager;
-
     public String pathOf( Artifact artifact )
     {
-        ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( artifact.getType()
);
+        ArtifactHandler artifactHandler = artifact.getArtifactHandler();
 
         StringBuffer path = new StringBuffer();
 

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/FlatRepositoryLayout.java
Sun Feb  3 09:46:23 2008
@@ -2,9 +2,9 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 
 /**
  * The code in this class is taken from DefaultRepositorylayout, located at:
@@ -20,12 +20,9 @@
 
     private static final char GROUP_SEPARATOR = '.';
 
-    /** @plexus.requirement */
-    private ArtifactHandlerManager artifactHandlerManager;
-
     public String pathOf( Artifact artifact )
     {
-        ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( artifact.getType()
);
+        ArtifactHandler artifactHandler = artifact.getArtifactHandler();
 
         StringBuffer path = new StringBuffer();
 

Modified: maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java
(original)
+++ maven/artifact/trunk/src/main/java/org/apache/maven/artifact/repository/layout/LegacyRepositoryLayout.java
Sun Feb  3 09:46:23 2008
@@ -21,7 +21,6 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.handler.ArtifactHandler;
-import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
@@ -34,12 +33,9 @@
 {
     private static final String PATH_SEPARATOR = "/";
 
-    /** @plexus.requirement */
-    private ArtifactHandlerManager artifactHandlerManager;
-
     public String pathOf( Artifact artifact )
     {
-        ArtifactHandler artifactHandler = artifactHandlerManager.getArtifactHandler( artifact.getType()
);
+        ArtifactHandler artifactHandler = artifact.getArtifactHandler();
 
         StringBuffer path = new StringBuffer();
 

Modified: maven/artifact/trunk/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
(original)
+++ maven/artifact/trunk/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
Sun Feb  3 09:46:23 2008
@@ -47,11 +47,12 @@
         throws Exception
     {
         super.setUp();
+        artifactHandler = new ArtifactHandlerMock();
         versionRange = VersionRange.createFromVersion( version );
-        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier
);
+        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier,
artifactHandler );
 
         snapshotVersionRange = VersionRange.createFromVersion( snapshotResolvedVersion );
-        snapshotArtifact = new DefaultArtifact( groupId, artifactId, snapshotVersionRange,
scope, type, classifier );
+        snapshotArtifact = new DefaultArtifact( groupId, artifactId, snapshotVersionRange,
scope, type, classifier, artifactHandler );
     }
 
     public void testGetVersionReturnsResolvedVersionOnSnapshot()
@@ -77,7 +78,7 @@
 
     public void testGetDependencyConflictIdNullClassifier()
     {
-        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null
);
+        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null,
artifactHandler );
         assertEquals( groupId + ":" + artifactId + ":" + type, artifact.getDependencyConflictId()
);
     }
 
@@ -101,7 +102,7 @@
 
     public void testToStringNullClassifier()
     {
-        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null
);
+        artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null,
artifactHandler );
         assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope,
artifact.toString() );
     }
 

Modified: maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
URL: http://svn.apache.org/viewvc/maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java?rev=618043&r1=618042&r2=618043&view=diff
==============================================================================
--- maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
(original)
+++ maven/artifact/trunk/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
Sun Feb  3 09:46:23 2008
@@ -138,7 +138,7 @@
         {
             tmpFile.deleteOnExit();
             Artifact artifact = new DefaultArtifact( "sample.group", "sample-art", VersionRange
-                .createFromVersion( "1.0" ), "artifactScope", "type", "classifier" );
+                .createFromVersion( "1.0" ), "artifactScope", "type", "classifier", null
);
             artifact.setFile( tmpFile );
             ArtifactRepository repo = new DefaultArtifactRepository( "id", "noop://url",
                                                                      new ArtifactRepositoryLayoutStub()
);



Mime
View raw message