diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/AbstractArtifactComponent.java b/maven-artifact/src/main/java/org/apache/maven/artifact/AbstractArtifactComponent.java index 6621426a52..74e12b0bb3 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/AbstractArtifactComponent.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/AbstractArtifactComponent.java @@ -24,22 +24,21 @@ import org.codehaus.plexus.logging.AbstractLogEnabled; /** * @todo refactor away - * @author Jason van Zyl - * @version $Id$ + * @author Jason van Zyl + * @version $Id: AbstractArtifactComponent.java,v 1.4 2005/03/08 05:34:52 brett + * Exp $ */ public class AbstractArtifactComponent extends AbstractLogEnabled { private ArtifactHandlerManager artifactHandlerManager; - protected ArtifactHandler getArtifactHandler( String type ) - throws ArtifactHandlerNotFoundException + protected ArtifactHandler getArtifactHandler( String type ) throws ArtifactHandlerNotFoundException { return artifactHandlerManager.getArtifactHandler( type ); } - protected String path( Artifact artifact ) - throws ArtifactHandlerNotFoundException + protected String path( Artifact artifact ) throws ArtifactHandlerNotFoundException { return artifactHandlerManager.path( artifact ); } @@ -47,6 +46,8 @@ public class AbstractArtifactComponent protected void setLocalRepositoryPath( Artifact artifact, ArtifactRepository localRepository ) throws ArtifactHandlerNotFoundException { - artifact.setPath( artifactHandlerManager.localRepositoryPath( artifact, localRepository ) ); + String artifactPath = artifactHandlerManager.localRepositoryPath( artifact, localRepository ); + + artifact.setPath( artifactPath ); } -} +} \ No newline at end of file diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java index 489ec83a85..d12eda7770 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/DefaultArtifact.java @@ -19,7 +19,7 @@ package org.apache.maven.artifact; import java.io.File; /** - * @author Jason van Zyl + * @author Jason van Zyl * @version $Id$ */ public class DefaultArtifact @@ -161,4 +161,4 @@ public class DefaultArtifact return this.groupId.equals( other.getGroupId() ) && this.artifactId.equals( other.getArtifactId() ) && this.version.equals( other.getVersion() ) && this.type.equals( other.getType() ); } -} +} \ No newline at end of file diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java index ce0e13ec91..c99a5a56d1 100644 --- a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java +++ b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java @@ -1,25 +1,22 @@ package org.apache.maven.artifact.manager; -/* ==================================================================== - * Copyright 2001-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * ==================================================================== + * Copyright 2001-2004 The Apache Software Foundation. Licensed under the Apache + * License, Version 2.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law + * or agreed to in writing, software distributed under the License is + * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. * ==================================================================== */ import org.apache.maven.artifact.AbstractArtifactComponent; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.authentication.AuthenticationInfoProvider; import org.apache.maven.wagon.ConnectionException; import org.apache.maven.wagon.ResourceDoesNotExistException; import org.apache.maven.wagon.TransferFailedException; @@ -41,8 +38,8 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; -import java.util.Set; public class DefaultWagonManager extends AbstractArtifactComponent @@ -54,8 +51,9 @@ public class DefaultWagonManager private TransferListener downloadMonitor; - public Wagon getWagon( String protocol ) - throws UnsupportedProtocolException + private AuthenticationInfoProvider authenticationInfoProvider; + + public Wagon getWagon( String protocol ) throws UnsupportedProtocolException { Wagon wagon; @@ -65,23 +63,24 @@ public class DefaultWagonManager } catch ( ComponentLookupException e ) { - throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " + protocol, e ); + throw new UnsupportedProtocolException( "Cannot find wagon which supports the requested protocol: " + + protocol, e ); } return wagon; } // TODO: don't throw exception - public void releaseWagon( Wagon wagon ) - throws Exception + public void releaseWagon( Wagon wagon ) throws Exception { container.release( wagon ); } // TODO: don't throw exception - public void put( File source, Artifact artifact, ArtifactRepository repository ) - throws Exception + public void put( File source, Artifact artifact, ArtifactRepository repository ) throws Exception { + authenticationInfoProvider.configureAuthenticationInfo( repository ); + Wagon wagon = getWagon( repository.getProtocol() ); wagon.connect( repository, getProxy( repository.getProtocol() ) ); @@ -93,7 +92,7 @@ public class DefaultWagonManager releaseWagon( wagon ); } - public void get( Artifact artifact, Set remoteRepositories, ArtifactRepository localRepository ) + public void get( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository ) throws TransferFailedException { get( artifact, artifact.getFile(), remoteRepositories ); @@ -109,19 +108,18 @@ public class DefaultWagonManager * @param destination * @throws TransferFailedException * @todo I want to somehow plug artifact validators at such low level. - * Simply if artifact was downloaded but it was rejected by validator(s) - * the loop should continue. Some of the validators can be feeded directly using events - * so number of i/o operation could be limited. - *
- * If we won't plug validation process here the question is what we can do afterwards? - * We don't know from which ArtifactRepository artifact was fetched and where we should restart. - * We should be also fetching md5 sums and such from the same exact directory then artifacts - * + * Simply if artifact was downloaded but it was rejected by + * validator(s) the loop should continue. Some of the validators can + * be feeded directly using events so number of i/o operation could be + * limited. If we won't plug validation process here the question + * is what we can do afterwards? We don't know from which + * ArtifactRepository artifact was fetched and where we should + * restart. We should be also fetching md5 sums and such from the same + * exact directory then artifacts * @todo probably all exceptions should just be logged and continue * @todo is the exception for warnings logged at debug level correct? */ - public void get( Artifact artifact, File destination, Set repositories ) - throws TransferFailedException + public void get( Artifact artifact, File destination, List repositories ) throws TransferFailedException { File temp = null; @@ -136,10 +134,13 @@ public class DefaultWagonManager try { + authenticationInfoProvider.configureAuthenticationInfo( repository ); + Wagon wagon = getWagon( repository.getProtocol() ); // ---------------------------------------------------------------------- - // These can certainly be configurable ... registering listeners ... + // These can certainly be configurable ... registering listeners + // ... //ChecksumObserver md5SumObserver = new ChecksumObserver(); @@ -203,10 +204,14 @@ public class DefaultWagonManager destination.getParentFile().mkdirs(); } - // The temporary file is named destination + ".tmp" and is done this way to ensure - // that the temporary file is in the same file system as the destination because the - // File.renameTo operation doesn't really work across file systems. So we will attempt - // to do a File.renameTo for efficiency and atomicity, if this fails then we will use + // The temporary file is named destination + ".tmp" and is done this + // way to ensure + // that the temporary file is in the same file system as the + // destination because the + // File.renameTo operation doesn't really work across file systems. + // So we will attempt + // to do a File.renameTo for efficiency and atomicity, if this fails + // then we will use // a brute force copy and delete the temporary file. if ( !temp.renameTo( destination ) ) @@ -236,19 +241,23 @@ public class DefaultWagonManager /** * Set the proxy used for a particular protocol. - * + * * @todo [BP] would be nice to configure this via plexus in some way - * - * @param protocol the protocol (required) - * @param host the proxy host name (required) - * @param port the proxy port (required) - * @param username the username for the proxy, or null if there is none - * @param password the password for the proxy, or null if there is none - * @param nonProxyHosts the set of hosts not to use the proxy for. Follows Java system property format: - **.foo.com|localhost
.
+ * @param protocol
+ * the protocol (required)
+ * @param host
+ * the proxy host name (required)
+ * @param port
+ * the proxy port (required)
+ * @param username
+ * the username for the proxy, or null if there is none
+ * @param password
+ * the password for the proxy, or null if there is none
+ * @param nonProxyHosts
+ * the set of hosts not to use the proxy for. Follows Java system
+ * property format: *.foo.com|localhost
.
*/
- public void setProxy( String protocol, String host, int port, String username, String password,
- String nonProxyHosts )
+ public void setProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts )
{
ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setHost( host );
@@ -261,8 +270,7 @@ public class DefaultWagonManager
proxies.put( protocol, proxyInfo );
}
- public void contextualize( Context context )
- throws ContextException
+ public void contextualize( Context context ) throws ContextException
{
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
@@ -273,4 +281,4 @@ public class DefaultWagonManager
this.downloadMonitor = downloadMonitor;
}
-}
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
index a2044241d5..93e08cdb04 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/manager/WagonManager.java
@@ -25,31 +25,27 @@ import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.events.TransferListener;
import java.io.File;
-import java.util.Set;
-
+import java.util.List;
/**
- * @author Michal Maczka
+ * @author Michal Maczka
* @version $Id$
*/
public interface WagonManager
{
String ROLE = WagonManager.class.getName();
- Wagon getWagon( String protocol )
- throws UnsupportedProtocolException;
+ Wagon getWagon( String protocol ) throws UnsupportedProtocolException;
// TODO: don't throw exception
- void releaseWagon( Wagon wagon )
- throws Exception;
+ void releaseWagon( Wagon wagon ) throws Exception;
- void get( Artifact artifact, Set remoteRepositories, ArtifactRepository localRepository )
+ void get( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws TransferFailedException;
// TODO: don't throw exception
- void put( File source, Artifact artifact, ArtifactRepository deploymentRepository )
- throws Exception;
-
+ void put( File source, Artifact artifact, ArtifactRepository deploymentRepository ) throws Exception;
+
void setProxy( String protocol, String host, int port, String username, String password, String nonProxyHosts );
void setDownloadMonitor( TransferListener downloadMonitor );
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
index 78ea964aff..eaa5880e18 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/metadata/ArtifactMetadataSource.java
@@ -19,6 +19,7 @@ package org.apache.maven.artifact.metadata;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import java.util.List;
import java.util.Set;
// Currently the only thing we need from the artifact metadata source is the
@@ -27,11 +28,11 @@ import java.util.Set;
// the artifact we may wish to provide in this layer. jvz.
/**
- * @author Jason van Zyl
+ * @author Jason van Zyl
* @version $Id$
*/
public interface ArtifactMetadataSource
{
- Set retrieve( Artifact artifact, ArtifactRepository localRepository, Set remoteRepositories )
+ Set retrieve( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories )
throws ArtifactMetadataRetrievalException;
-}
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java
index 4fa684fbd9..cf4a423e2b 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/ArtifactRepository.java
@@ -19,71 +19,39 @@ package org.apache.maven.artifact.repository;
import org.apache.maven.wagon.repository.Repository;
/**
- * This class is an abstraction of the location from/to resources
- * can be transfered.
- *
- * @author Michal Maczka
+ * This class is an abstraction of the location from/to resources can be
+ * transfered.
+ *
+ * @author Michal Maczka
* @version $Id$
*/
public class ArtifactRepository
extends Repository
{
- public ArtifactRepository()
- {
- }
+ // public ArtifactRepository()
+ // {
+ // }
- public ArtifactRepository( String id, String url)
+ public ArtifactRepository( String id, String url )
{
super( id, url );
}
/*
- private String layout;
-
- public String getLayout()
- {
- if ( layout == null )
- {
- return "${groupId}/${type}s/${artifactId}-${version}.${extension}";
- }
-
- return layout;
- }
-
- public String artifactPath( Artifact artifact )
- {
- return interpolateLayout( artifact.getGroupId(),
- artifact.getArtifactId(),
- artifact.getVersion(),
- artifact.getType(),
- artifact.getExtension() );
- }
-
- public String fullArtifactPath( Artifact artifact )
- {
- return getBasedir() + "/" + artifactPath( artifact );
- }
-
- public String artifactUrl( Artifact artifact )
- {
- return getUrl() + "/" + artifactPath( artifact );
- }
-
- private String interpolateLayout( String groupId, String artifactId, String version, String type, String extension )
- {
- String layout = getLayout();
-
- layout = StringUtils.replace( layout, "${groupId}", groupId );
-
- layout = StringUtils.replace( layout, "${artifactId}", artifactId );
-
- layout = StringUtils.replace( layout, "${type}", type );
-
- layout = StringUtils.replace( layout, "${version}", version );
-
- layout = StringUtils.replace( layout, "${extension}", extension );
-
- return layout;
- }
- */
-}
+ * private String layout; public String getLayout() { if ( layout == null ) {
+ * return "${groupId}/${type}s/${artifactId}-${version}.${extension}"; }
+ * return layout; } public String artifactPath( Artifact artifact ) { return
+ * interpolateLayout( artifact.getGroupId(), artifact.getArtifactId(),
+ * artifact.getVersion(), artifact.getType(), artifact.getExtension() ); }
+ * public String fullArtifactPath( Artifact artifact ) { return getBasedir() +
+ * "/" + artifactPath( artifact ); } public String artifactUrl( Artifact
+ * artifact ) { return getUrl() + "/" + artifactPath( artifact ); } private
+ * String interpolateLayout( String groupId, String artifactId, String
+ * version, String type, String extension ) { String layout = getLayout();
+ * layout = StringUtils.replace( layout, "${groupId}", groupId ); layout =
+ * StringUtils.replace( layout, "${artifactId}", artifactId ); layout =
+ * StringUtils.replace( layout, "${type}", type ); layout =
+ * StringUtils.replace( layout, "${version}", version ); layout =
+ * StringUtils.replace( layout, "${extension}", extension ); return layout; }
+ */
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/repository/authentication/AuthenticationInfoProvider.java b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/authentication/AuthenticationInfoProvider.java
new file mode 100644
index 0000000000..6540e0d85a
--- /dev/null
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/repository/authentication/AuthenticationInfoProvider.java
@@ -0,0 +1,15 @@
+package org.apache.maven.artifact.repository.authentication;
+
+import org.apache.maven.wagon.repository.Repository;
+
+/**
+ * @author jdcasey
+ */
+public interface AuthenticationInfoProvider
+{
+ public static final String ROLE = AuthenticationInfoProvider.class.getName();
+
+ // TODO: do not throw Exception.
+ void configureAuthenticationInfo( Repository wagonRepository ) throws Exception;
+
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
index 7e9c76b53b..eb5fb5d1b2 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/ArtifactResolver.java
@@ -1,56 +1,42 @@
package org.apache.maven.artifact.resolver;
import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.transform.ArtifactRequestTransformation;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import java.util.List;
import java.util.Set;
/**
- * I want to use it for hidding the fact that sometime artifact must
- * be downloaded. I am just asking LocalRepository for given artifact
- * and I don't care if it is alredy there or how it will get there.
- *
- * @author Michal Maczka
+ * I want to use it for hidding the fact that sometime artifact must be
+ * downloaded. I am just asking LocalRepository for given artifact and I don't
+ * care if it is alredy there or how it will get there.
+ *
+ * @author Michal Maczka
* @version $Id$
*/
public interface ArtifactResolver
{
static String ROLE = ArtifactResolver.class.getName();
- Artifact resolve( Artifact artifact,
- Set remoteRepositories,
- ArtifactRepository localRepository )
- throws ArtifactResolutionException;
-
- ArtifactResolutionResult resolveTransitively( Artifact artifact,
- Set remoteRepositories,
- ArtifactRepository localRepository,
- ArtifactMetadataSource source )
+ Artifact resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException;
-
-
- Set resolve( Set artifacts,
- Set remoteRepositories,
- ArtifactRepository localRepository )
+ ArtifactResolutionResult resolveTransitively( Artifact artifact, List remoteRepositories,
+ ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException;
+
+ Set resolve( Set artifacts, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException;
- ArtifactResolutionResult resolveTransitively( Set artifacts,
- Set remoteRepositories,
- ArtifactRepository localRepository,
- ArtifactMetadataSource source )
+ ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
+ ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException;
+
+ ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
+ ArtifactRepository localRepository, ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException;
- ArtifactResolutionResult resolveTransitively( Set artifacts,
- Set remoteRepositories,
- ArtifactRepository localRepository,
- ArtifactMetadataSource source,
- ArtifactFilter filter )
- throws ArtifactResolutionException;
+ void addArtifactRequestTransformation(
+ org.apache.maven.artifact.resolver.transform.ArtifactRequestTransformation requestTransformation );
- void addArtifactRequestTransformation( org.apache.maven.artifact.resolver.transform.ArtifactRequestTransformation requestTransformation );
-
-}
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
index 0d251688a5..caa8265fb8 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
@@ -21,7 +21,8 @@ import java.util.Map;
import java.util.Set;
/**
- * @todo get rid of {@link AbstractArtifactComponent} and then create an AbstractArtifactResolver that does the transitive boilerplate
+ * @todo get rid of {@link AbstractArtifactComponent}and then create an
+ * AbstractArtifactResolver that does the transitive boilerplate
*/
public class DefaultArtifactResolver
extends AbstractArtifactComponent
@@ -32,7 +33,7 @@ public class DefaultArtifactResolver
// ----------------------------------------------------------------------
private List requestTransformations;
-
+
// ----------------------------------------------------------------------
// Components
// ----------------------------------------------------------------------
@@ -43,9 +44,7 @@ public class DefaultArtifactResolver
// Implementation
// ----------------------------------------------------------------------
- public Artifact resolve( Artifact artifact,
- Set remoteRepositories,
- ArtifactRepository localRepository )
+ public Artifact resolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException
{
// ----------------------------------------------------------------------
@@ -54,7 +53,8 @@ public class DefaultArtifactResolver
// ----------------------------------------------------------------------
// Check for the existence of the artifact in the specified local
- // ArtifactRepository. If it is present then simply return as the request
+ // ArtifactRepository. If it is present then simply return as the
+ // request
// for resolution has been satisfied.
// ----------------------------------------------------------------------
@@ -83,19 +83,19 @@ public class DefaultArtifactResolver
private static final String LS = System.getProperty( "line.separator" );
- private String artifactNotFound( Artifact artifact, Set remoteRepositories )
+ private String artifactNotFound( Artifact artifact, List remoteRepositories )
{
StringBuffer sb = new StringBuffer();
sb.append( "The artifact is not present locally as:" )
- .append( LS )
- .append( LS )
- .append( artifact.getPath() )
- .append( LS )
- .append( LS )
- .append( "or in any of the specified remote repositories:" )
- .append( LS )
- .append( LS );
+ .append( LS )
+ .append( LS )
+ .append( artifact.getPath() )
+ .append( LS )
+ .append( LS )
+ .append( "or in any of the specified remote repositories:" )
+ .append( LS )
+ .append( LS );
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
{
@@ -111,9 +111,7 @@ public class DefaultArtifactResolver
return sb.toString();
}
- public Set resolve( Set artifacts,
- Set remoteRepositories,
- ArtifactRepository localRepository )
+ public Set resolve( Set artifacts, List remoteRepositories, ArtifactRepository localRepository )
throws ArtifactResolutionException
{
Set resolvedArtifacts = new HashSet();
@@ -134,22 +132,15 @@ public class DefaultArtifactResolver
// Transitive modes
// ----------------------------------------------------------------------
- public ArtifactResolutionResult resolveTransitively( Set artifacts,
- Set remoteRepositories,
- ArtifactRepository localRepository,
- ArtifactMetadataSource source,
- ArtifactFilter filter )
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
+ ArtifactRepository localRepository, ArtifactMetadataSource source, ArtifactFilter filter )
throws ArtifactResolutionException
{
ArtifactResolutionResult artifactResolutionResult;
try
{
- artifactResolutionResult = collect( artifacts,
- localRepository,
- remoteRepositories,
- source,
- filter );
+ artifactResolutionResult = collect( artifacts, localRepository, remoteRepositories, source, filter );
}
catch ( TransitiveArtifactResolutionException e )
{
@@ -164,34 +155,24 @@ public class DefaultArtifactResolver
return artifactResolutionResult;
}
- public ArtifactResolutionResult resolveTransitively( Set artifacts,
- Set remoteRepositories,
- ArtifactRepository localRepository,
- ArtifactMetadataSource source )
- throws ArtifactResolutionException
+ public ArtifactResolutionResult resolveTransitively( Set artifacts, List remoteRepositories,
+ ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException
{
return resolveTransitively( artifacts, remoteRepositories, localRepository, source, null );
}
- public ArtifactResolutionResult resolveTransitively( Artifact artifact,
- Set remoteRepositories,
- ArtifactRepository localRepository,
- ArtifactMetadataSource source )
- throws ArtifactResolutionException
+ public ArtifactResolutionResult resolveTransitively( Artifact artifact, List remoteRepositories,
+ ArtifactRepository localRepository, ArtifactMetadataSource source ) throws ArtifactResolutionException
{
return resolveTransitively( Collections.singleton( artifact ), remoteRepositories, localRepository, source );
}
-
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
- private ArtifactResolutionResult collect( Set artifacts,
- ArtifactRepository localRepository,
- Set remoteRepositories,
- ArtifactMetadataSource source,
- ArtifactFilter filter )
+ private ArtifactResolutionResult collect( Set artifacts, ArtifactRepository localRepository,
+ List remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter )
throws TransitiveArtifactResolutionException
{
ArtifactResolutionResult result = new ArtifactResolutionResult();
@@ -246,10 +227,12 @@ public class DefaultArtifactResolver
}
catch ( ArtifactMetadataRetrievalException e )
{
- throw new TransitiveArtifactResolutionException( "Error retrieving metadata [" + newArtifact + "] : ", e );
+ throw new TransitiveArtifactResolutionException( "Error retrieving metadata [" + newArtifact
+ + "] : ", e );
}
- // the pom for given dependency exisit we will add it to the queue
+ // the pom for given dependency exisit we will add it to the
+ // queue
queue.add( referencedDependencies );
}
}
@@ -257,7 +240,8 @@ public class DefaultArtifactResolver
// ----------------------------------------------------------------------
// the dependencies list is keyed by groupId+artifactId+type
- // so it must be 'rekeyed' to the complete id: groupId+artifactId+type+version
+ // so it must be 'rekeyed' to the complete id:
+ // groupId+artifactId+type+version
// ----------------------------------------------------------------------
Map artifactResult = result.getArtifacts();
@@ -303,4 +287,4 @@ public class DefaultArtifactResolver
{
}
-}
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/ArtifactRequestTransformation.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/ArtifactRequestTransformation.java
index 2a5a745945..b8046e38b4 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/ArtifactRequestTransformation.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/ArtifactRequestTransformation.java
@@ -3,8 +3,8 @@ package org.apache.maven.artifact.resolver.transform;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
/*
* Copyright 2001-2004 The Apache Software Foundation.
@@ -23,8 +23,9 @@ import java.util.Set;
*/
/**
- * @author Jason van Zyl
- * @version $Id$
+ * @author Jason van Zyl
+ * @version $Id: ArtifactRequestTransformation.java,v 1.1 2005/03/03 15:37:25
+ * jvanzyl Exp $
*/
public interface ArtifactRequestTransformation
{
@@ -33,13 +34,11 @@ public interface ArtifactRequestTransformation
/**
* Take in a artifact and return the transformed artifact. If no
* transformation has occured the original artifact is returned.
- *
- * @param artifact Artifact to be transformed.
+ *
+ * @param artifact
+ * Artifact to be transformed.
* @return The transformed Artifact
*/
- Artifact transform( Artifact artifact,
- ArtifactRepository localRepository,
- Set remoteRepositories,
- Map parameters )
+ Artifact transform( Artifact artifact, ArtifactRepository localRepository, List remoteRepositories, Map parameters )
throws Exception;
-}
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/SnapshotRequestTransformation.java b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/SnapshotRequestTransformation.java
index 9010ff1dcd..c34e5ea6e8 100644
--- a/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/SnapshotRequestTransformation.java
+++ b/maven-artifact/src/main/java/org/apache/maven/artifact/resolver/transform/SnapshotRequestTransformation.java
@@ -9,23 +9,21 @@ import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.TimeZone;
/**
- * @author Michal Maczka
- * @version $Id$
+ * @author Michal Maczka
+ * @version $Id: SnapshotRequestTransformation.java,v 1.1 2005/03/03 15:37:25
+ * jvanzyl Exp $
*/
public class SnapshotRequestTransformation
implements ArtifactRequestTransformation
{
private ArtifactResolver artifactResolver;
- public Artifact transform( Artifact artifact,
- ArtifactRepository localRepository,
- Set repositories,
- Map parameters )
+ public Artifact transform( Artifact artifact, ArtifactRepository localRepository, List repositories, Map parameters )
throws Exception
{
Date localVersion = getLocalVersion( artifact, localRepository );
@@ -34,7 +32,7 @@ public class SnapshotRequestTransformation
if ( remoteVersion != null )
{
- //if local version is unknown (null) it means that
+ //if local version is unknown (null) it means that
//we don't have this file locally. so we will be happy
// to have any snapshot.
// we wil download in two cases:
@@ -49,7 +47,8 @@ public class SnapshotRequestTransformation
// We can change the strategy which is used here later on
// @todo we will delete old file first.
- //it is not really a right thing to do. Artifact Dowloader should
+ //it is not really a right thing to do. Artifact Dowloader
+ // should
// fetch to temprary file and replace the old file with the new
// one once download was finished
@@ -80,7 +79,7 @@ public class SnapshotRequestTransformation
//return new File( localRepository.fullArtifactPath( artifact ) );
}
- private Date getRemoteVersion( Artifact artifact, Set remoteRepositories, ArtifactRepository localRepository )
+ private Date getRemoteVersion( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
throws Exception
{
Date retValue = null;
@@ -119,7 +118,8 @@ public class SnapshotRequestTransformation
if ( retValue == null )
{
- //try "traditional method" used in maven1 for obtaining snapshot version
+ //try "traditional method" used in maven1 for obtaining snapshot
+ // version
File file = artifact.getFile();
@@ -129,12 +129,10 @@ public class SnapshotRequestTransformation
//@todo we should "normalize" the time.
- /*TimeZone gmtTimeZone = TimeZone.getTimeZone( "GMT" );
-
- TimeZone userTimeZone = TimeZone.getDefault();
-
- long diff =
- */
+ /*
+ * TimeZone gmtTimeZone = TimeZone.getTimeZone( "GMT" );
+ * TimeZone userTimeZone = TimeZone.getDefault(); long diff =
+ */
}
}
@@ -163,18 +161,17 @@ public class SnapshotRequestTransformation
return retValue;
}
- public static Date parseTimestamp ( String timestamp )
- throws ParseException
+ public static Date parseTimestamp( String timestamp ) throws ParseException
{
Date retValue = getFormatter().parse( timestamp );
return retValue;
}
- public static String getTimestamp ( Date snapshotVersion )
+ public static String getTimestamp( Date snapshotVersion )
{
String retValue = getFormatter().format( snapshotVersion );
return retValue;
}
-}
+}
\ No newline at end of file
diff --git a/maven-artifact/src/main/resources/META-INF/plexus/components.xml b/maven-artifact/src/main/resources/META-INF/plexus/components.xml
index 99af460313..4424880867 100644
--- a/maven-artifact/src/main/resources/META-INF/plexus/components.xml
+++ b/maven-artifact/src/main/resources/META-INF/plexus/components.xml
@@ -31,9 +31,12 @@