maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvan...@apache.org
Subject svn commit: r786995 - in /maven/components/trunk: maven-compat/src/main/java/org/apache/maven/artifact/factory/ maven-compat/src/main/java/org/apache/maven/artifact/repository/ maven-compat/src/test/java/org/apache/maven/artifact/ maven-compat/src/test...
Date Sun, 21 Jun 2009 11:39:11 GMT
Author: jvanzyl
Date: Sun Jun 21 11:39:10 2009
New Revision: 786995

URL: http://svn.apache.org/viewvc?rev=786995&view=rev
Log:
MNG-4216: Remove all direct usage of DefaultArtifactRepository

Added:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java   (with props)
Modified:
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
    maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java
    maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
    maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
    maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
    maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DefaultMirrorBuilder.java
    maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java
    maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java
    maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java
    maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
    maven/components/trunk/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/factory/ArtifactFactory.java Sun Jun 21 11:39:10 2009
@@ -1,22 +1,18 @@
 package org.apache.maven.artifact.factory;
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you 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.Artifact;
@@ -27,73 +23,27 @@
     String ROLE = ArtifactFactory.class.getName();
 
     // TODO: deprecate and chase down (probably used for copying only)
-    Artifact createArtifact( String groupId,
-                             String artifactId,
-                             String version,
-                             String scope,
-                             String type );
-
-    Artifact createArtifactWithClassifier( String groupId,
-                                           String artifactId,
-                                           String version,
-                                           String type,
-                                           String classifier );
-
-    Artifact createDependencyArtifact( String groupId,
-                                       String artifactId,
-                                       VersionRange versionRange,
-                                       String type,
-                                       String classifier,
-                                       String scope );
-
-    Artifact createDependencyArtifact( String groupId,
-                                       String artifactId,
-                                       VersionRange versionRange,
-                                       String type,
-                                       String classifier,
-                                       String scope,
-                                       boolean optional );
-
-    Artifact createDependencyArtifact( String groupId,
-                                       String artifactId,
-                                       VersionRange versionRange,
-                                       String type,
-                                       String classifier,
-                                       String scope,
-                                       String inheritedScope );
-
-    Artifact createDependencyArtifact( String groupId,
-                                       String artifactId,
-                                       VersionRange versionRange,
-                                       String type,
-                                       String classifier,
-                                       String scope,
-                                       String inheritedScope,
-                                       boolean optional );
-
-    Artifact createBuildArtifact( String groupId,
-                                  String artifactId,
-                                  String version,
-                                  String packaging );
-
-    Artifact createProjectArtifact( String groupId,
-                                    String artifactId,
-                                    String version );
-
-    Artifact createParentArtifact( String groupId,
-                                   String artifactId,
-                                   String version );
-
-    Artifact createPluginArtifact( String groupId,
-                                   String artifactId,
-                                   VersionRange versionRange );
-
-    Artifact createProjectArtifact( String groupId,
-                                    String artifactId,
-                                    String version,
-                                    String scope );
-
-    Artifact createExtensionArtifact( String groupId,
-                                      String artifactId,
-                                      VersionRange versionRange );
+    Artifact createArtifact( String groupId, String artifactId, String version, String scope, String type );
+
+    Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, String type, String classifier );
+
+    Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope );
+
+    Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, boolean optional );
+
+    Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope );
+
+    Artifact createDependencyArtifact( String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope, String inheritedScope, boolean optional );
+
+    Artifact createBuildArtifact( String groupId, String artifactId, String version, String packaging );
+
+    Artifact createProjectArtifact( String groupId, String artifactId, String version );
+
+    Artifact createParentArtifact( String groupId, String artifactId, String version );
+
+    Artifact createPluginArtifact( String groupId, String artifactId, VersionRange versionRange );
+
+    Artifact createProjectArtifact( String groupId, String artifactId, String version, String scope );
+
+    Artifact createExtensionArtifact( String groupId, String artifactId, VersionRange versionRange );
 }

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/ArtifactRepositoryFactory.java Sun Jun 21 11:39:10 2009
@@ -1,27 +1,20 @@
 package org.apache.maven.artifact.repository;
 
 /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you 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 java.io.File;
-
-import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.UnknownRepositoryLayoutException;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 
@@ -34,35 +27,18 @@
 
     String LOCAL_REPOSITORY_ID = "local";
 
-    ArtifactRepository createLocalRepository( File localRepositoryDirectory )
-        throws InvalidRepositoryException;
-
     ArtifactRepositoryLayout getLayout( String layoutId )
         throws UnknownRepositoryLayoutException;
 
-    ArtifactRepository createDeploymentArtifactRepository( String id,
-                                                           String url,
-                                                           String layoutId,
-                                                           boolean uniqueVersion )
+    ArtifactRepository createDeploymentArtifactRepository( String id, String url, String layoutId, boolean uniqueVersion )
         throws UnknownRepositoryLayoutException;
 
-    ArtifactRepository createDeploymentArtifactRepository( String id,
-                                                           String url,
-                                                           ArtifactRepositoryLayout layout,
-                                                           boolean uniqueVersion );
-
-    ArtifactRepository createArtifactRepository( String id,
-                                                 String url,
-                                                 String layoutId,
-                                                 ArtifactRepositoryPolicy snapshots,
-                                                 ArtifactRepositoryPolicy releases )
+    ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion );
+
+    ArtifactRepository createArtifactRepository( String id, String url, String layoutId, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
         throws UnknownRepositoryLayoutException;
 
-    ArtifactRepository createArtifactRepository( String id,
-                                                 String url,
-                                                 ArtifactRepositoryLayout repositoryLayout,
-                                                 ArtifactRepositoryPolicy snapshots,
-                                                 ArtifactRepositoryPolicy releases );
+    ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases );
 
     void setGlobalUpdatePolicy( String snapshotPolicy );
 

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepository.java Sun Jun 21 11:39:10 2009
@@ -45,10 +45,6 @@
     private ArtifactRepositoryPolicy releases;
 
     private boolean blacklisted;
-
-    public DefaultArtifactRepository()
-    {
-    }
     
     /**
      * Create a local repository or a test repository.

Modified: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java (original)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java Sun Jun 21 11:39:10 2009
@@ -19,12 +19,9 @@
  * under the License.
  */
 
-import java.io.File;
-import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.UnknownRepositoryLayoutException;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.codehaus.plexus.component.annotations.Component;
@@ -83,7 +80,7 @@
                                                                   ArtifactRepositoryLayout repositoryLayout,
                                                                   boolean uniqueVersion )
     {
-        return new DefaultArtifactRepository( id, url, repositoryLayout, uniqueVersion );
+        return createArtifactRepository( id, url, repositoryLayout, null, null );
     }
 
     public ArtifactRepository createArtifactRepository( String id,
@@ -139,7 +136,7 @@
             releases.setChecksumPolicy( globalChecksumPolicy );
         }
 
-        DefaultArtifactRepository repository = new DefaultArtifactRepository( id, url, repositoryLayout, snapshots, releases );
+        ArtifactRepository repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
         repository.setBlacklisted( blacklisted );
 
         artifactRepositories.put( id, repository );
@@ -156,30 +153,4 @@
     {
         globalChecksumPolicy = checksumPolicy;
     }
-
-    public ArtifactRepository createLocalRepository( File localRepositoryDirectory )
-        throws InvalidRepositoryException
-    {
-        ArtifactRepositoryLayout layout = getLayout( DEFAULT_LAYOUT_ID );
-        DefaultArtifactRepository repo;
-        try
-        {
-            repo = new DefaultArtifactRepository( LOCAL_REPOSITORY_ID,
-                localRepositoryDirectory.toURI()
-                    .toURL()
-                    .toExternalForm(),
-                layout, new ArtifactRepositoryPolicy(),
-                new ArtifactRepositoryPolicy() );
-        }
-        catch ( MalformedURLException e )
-        {
-            throw new InvalidRepositoryException( "Invalid local repository directory: "
-                + localRepositoryDirectory
-                + ". Cannot render URL.", LOCAL_REPOSITORY_ID, e );
-        }
-
-        repo.setBasedir( localRepositoryDirectory.getAbsolutePath() );
-
-        return repo;
-    }
-}
+ }

Added: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java?rev=786995&view=auto
==============================================================================
--- maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java (added)
+++ maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java Sun Jun 21 11:39:10 2009
@@ -0,0 +1,351 @@
+package org.apache.maven.artifact.repository;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 java.io.File;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadata;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
+
+//TODO: http://jira.codehaus.org/browse/MNG-4215
+//TODO: completely separate local and remote artifact repositories
+public class MavenArtifactRepository
+    implements ArtifactRepository
+{
+    public static final int UNKNOWN_PORT = -1;
+    
+    private String id;
+    
+    private String url;
+    
+    private String basedir;
+    
+    private String protocol;
+    
+    private ArtifactRepositoryLayout layout;
+
+    private ArtifactRepositoryPolicy snapshots;
+
+    private ArtifactRepositoryPolicy releases;
+
+    //TODO: this should be tracked externally, not by the repository itself
+    private boolean blacklisted;
+    
+    public MavenArtifactRepository()
+    {
+    }
+
+    /**
+     * Create a remote download repository.
+     *
+     * @param id        the unique identifier of the repository
+     * @param url       the URL of the repository
+     * @param layout    the layout of the repository
+     * @param snapshots the policies to use for snapshots
+     * @param releases  the policies to use for releases
+     */
+    public MavenArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
+    {
+        this.id = id;
+        this.url = url;
+        this.layout = layout;
+        
+        //
+        // Derive these from the URL
+        //
+        this.protocol = protocol( url );
+        this.basedir = basedir( url );            
+        this.snapshots = snapshots;
+        this.releases = releases;
+
+        if ( this.snapshots == null )
+        {
+            this.snapshots = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
+        }
+
+        if ( this.releases == null )
+        {
+            this.releases = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE );
+        }        
+    }
+
+    public String pathOf( Artifact artifact )
+    {
+        return layout.pathOf( artifact );
+    }
+
+    public String pathOfRemoteRepositoryMetadata( ArtifactMetadata artifactMetadata )
+    {
+        return layout.pathOfRemoteRepositoryMetadata( artifactMetadata );
+    }
+
+    public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
+    {
+        return layout.pathOfLocalRepositoryMetadata( metadata, repository );
+    }
+
+    public void setLayout( ArtifactRepositoryLayout layout )
+    {
+        this.layout = layout;
+    }
+    
+    public ArtifactRepositoryLayout getLayout()
+    {
+        return layout;
+    }
+
+    public void setSnapshotUpdatePolicy( ArtifactRepositoryPolicy snapshots )
+    {
+        this.snapshots = snapshots;
+    }
+    
+    public ArtifactRepositoryPolicy getSnapshots()
+    {
+        return snapshots;
+    }
+
+    public void setReleaseUpdatePolicy( ArtifactRepositoryPolicy releases )
+    {
+        this.releases = releases;
+    }
+
+    public ArtifactRepositoryPolicy getReleases()
+    {
+        return releases;
+    }
+
+    public String getKey()
+    {
+        return getId();
+    }
+
+    public boolean isBlacklisted()
+    {
+        return blacklisted;
+    }
+
+    public void setBlacklisted( boolean blacklisted )
+    {
+        this.blacklisted = blacklisted;
+    }
+    
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "       id: " ).append( getId() ).append( "\n" );
+        sb.append( "      url: " ).append( getUrl() ).append( "\n" );
+        sb.append( "   layout: " ).append( layout != null ? layout.getId() : "none" ).append( "\n" );
+        
+        if ( snapshots != null )
+        {
+            sb.append( "snapshots: [enabled => " ).append( snapshots.isEnabled() );
+            sb.append( ", update => " ).append( snapshots.getUpdatePolicy() ).append( "]\n" );
+        }
+        
+        if ( releases != null )
+        {
+            sb.append( " releases: [enabled => " ).append( releases.isEnabled() );
+            sb.append( ", update => " ).append( releases.getUpdatePolicy() ).append( "]\n" );
+        }
+
+        return sb.toString();
+    }
+
+    public Artifact find( Artifact artifact )
+    {
+        File artifactFile = new File( getBasedir(), pathOf( artifact ) );
+        
+        // We need to set the file here or the resolver will fail with an NPE, not fully equipped to deal
+        // with multiple local repository implementations yet.
+        artifact.setFile( artifactFile );
+        
+        if( artifactFile.exists() )
+        {            
+            artifact.setResolved( true );            
+        }
+                
+        return artifact;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public String getBasedir()
+    {
+        return basedir;
+    }
+
+    public String getProtocol()
+    {
+        return protocol;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+
+    public void setBasedir( String basedir )
+    {
+        this.basedir = basedir;
+    }
+
+    public void setProtocol( String protocol )
+    {
+        this.protocol = protocol;
+    }
+    
+    // Path Utils
+    
+    /**
+     * /**
+     * Return the protocol name.
+     * <br/>
+     * E.g: for input
+     * <code>http://www.codehause.org</code> this method will return <code>http</code>
+     *
+     * @param url the url
+     * @return the host name
+     */
+    public static String protocol( final String url )
+    {
+        final int pos = url.indexOf( ":" );
+
+        if ( pos == -1 )
+        {
+            return "";
+        }
+        return url.substring( 0, pos ).trim();
+    }
+
+    /**
+     * Derive the path portion of the given URL.
+     * 
+     * @param url the repository URL
+     * @return the basedir of the repository
+     * @todo need to URL decode for spaces?
+     */
+    public String basedir( String url )
+    {
+        String retValue = null;
+
+        if ( protocol.equalsIgnoreCase( "file" ) )
+        {
+            retValue = url.substring( protocol.length() + 1 );
+            // special case: if omitted // on protocol, keep path as is
+            if ( retValue.startsWith( "//" ) )
+            {
+                retValue = retValue.substring( 2 );
+
+                if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
+                {
+                    // special case: if there is a windows drive letter, then keep the original return value
+                    retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
+                }
+                else
+                {
+                    // Now we expect the host
+                    int index = retValue.indexOf( "/" );
+                    if ( index >= 0 )
+                    {
+                        retValue = retValue.substring( index + 1 );
+                    }
+
+                    // special case: if there is a windows drive letter, then keep the original return value
+                    if ( retValue.length() >= 2 && ( retValue.charAt( 1 ) == '|' || retValue.charAt( 1 ) == ':' ) )
+                    {
+                        retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
+                    }
+                    else if ( index >= 0 )
+                    {
+                        // leading / was previously stripped
+                        retValue = "/" + retValue;
+                    }
+                }
+            }
+
+            // special case: if there is a windows drive letter using |, switch to :
+            if ( retValue.length() >= 2 && retValue.charAt( 1 ) == '|' )
+            {
+                retValue = retValue.charAt( 0 ) + ":" + retValue.substring( 2 );
+            }
+        }
+
+        if ( retValue == null )
+        {
+            retValue = "/";
+        }
+        return retValue.trim();
+    }
+    
+    public int hashCode()
+    {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ( ( id == null ) ? 0 : id.hashCode() );
+        return result;
+    }
+
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+        if ( obj == null )
+        {
+            return false;
+        }
+        if ( getClass() != obj.getClass() )
+        {
+            return false;
+        }
+        
+        final ArtifactRepository other = (ArtifactRepository) obj;
+        
+        if ( id == null )
+        {
+            if ( other.getId() != null )
+            {
+                return false;
+            }
+        }
+        else if ( !id.equals( other.getId() ) )
+        {
+            return false;
+        }
+        
+        return true;
+    }    
+}

Propchange: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-compat/src/main/java/org/apache/maven/artifact/repository/MavenArtifactRepository.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java (original)
+++ maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java Sun Jun 21 11:39:10 2009
@@ -29,6 +29,7 @@
 
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
@@ -43,13 +44,15 @@
 {
     protected ArtifactFactory artifactFactory;
 
+    protected ArtifactRepositoryFactory artifactRepositoryFactory;
+    
     @Override
     protected void setUp()
         throws Exception
     {
         super.setUp();
-
-        artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
+        artifactFactory = lookup( ArtifactFactory.class);        
+        artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
     }
     
     @Override
@@ -80,7 +83,7 @@
         ArtifactRepositoryLayout repoLayout =
             (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
 
-        return new DefaultArtifactRepository( "test", "file://" + f.getPath(), repoLayout );
+        return artifactRepositoryFactory.createArtifactRepository( "test", "file://" + f.getPath(), repoLayout, null, null );
     }
 
     protected String getRepositoryLayout()
@@ -98,7 +101,7 @@
         ArtifactRepositoryLayout repoLayout =
             (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
 
-        return new DefaultArtifactRepository( "local", "file://" + f.getPath(), repoLayout );
+        return artifactRepositoryFactory.createArtifactRepository( "local", "file://" + f.getPath(), repoLayout, null, null );
     }
 
     protected ArtifactRepository remoteRepository()
@@ -111,7 +114,7 @@
         ArtifactRepositoryLayout repoLayout =
             (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
 
-        return new DefaultArtifactRepository( "test", "file://" + f.getPath(), repoLayout,
+        return artifactRepositoryFactory.createArtifactRepository( "test", "file://" + f.getPath(), repoLayout,
                                               new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() );
     }
 
@@ -121,7 +124,7 @@
         ArtifactRepositoryLayout repoLayout =
             (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
 
-        return new DefaultArtifactRepository( "test", "http://foo.bar/repository", repoLayout );
+        return artifactRepositoryFactory.createArtifactRepository( "test", "http://foo.bar/repository", repoLayout, null, null );
     }
 
     protected void assertRemoteArtifactPresent( Artifact artifact )

Modified: maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java (original)
+++ maven/components/trunk/maven-compat/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java Sun Jun 21 11:39:10 2009
@@ -30,6 +30,7 @@
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
@@ -62,15 +63,16 @@
     private TransferListener transferListener = new Debug();
 
     private ArtifactFactory artifactFactory;
+    
+    private ArtifactRepositoryFactory artifactRepositoryFactory;
 
     protected void setUp()
         throws Exception
     {
         super.setUp();
-
-        wagonManager = (DefaultWagonManager) lookup( WagonManager.class );
-        
-        artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
+        wagonManager = (DefaultWagonManager) lookup( WagonManager.class );        
+        artifactFactory = lookup( ArtifactFactory.class );
+        artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );
     }
     
     @Override
@@ -91,8 +93,8 @@
         Artifact artifact = createTestPomArtifact( "target/test-data/get-missing-pom" );
 
         List<ArtifactRepository> repos = new ArrayList<ArtifactRepository>();
-        repos.add(new DefaultArtifactRepository( "repo1", "string://url1", new ArtifactRepositoryLayoutStub() ));
-        repos.add(new DefaultArtifactRepository( "repo2", "string://url2", new ArtifactRepositoryLayoutStub() ));
+        repos.add(artifactRepositoryFactory.createArtifactRepository( "repo1", "string://url1", new ArtifactRepositoryLayoutStub(), null, null ));
+        repos.add(artifactRepositoryFactory.createArtifactRepository( "repo2", "string://url2", new ArtifactRepositoryLayoutStub(), null, null ));
 
         StringWagon wagon = (StringWagon) wagonManager.getWagon( "string" );
         wagon.addExpectedContent( repos.get(0).getLayout().pathOf( artifact ), "expected" );
@@ -259,12 +261,9 @@
 
     private ArtifactRepository createStringRepo()
     {
-        ArtifactRepository repo =
-            new DefaultArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub() );
-        return repo;
+        return artifactRepositoryFactory.createArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub(), null, null );
     }
     
-
     /**
      * Build an ArtifactRepository object.
      * 
@@ -274,7 +273,7 @@
      */
     private ArtifactRepository getRepo( String id, String url )
     {
-        return new DefaultArtifactRepository( id, url, new DefaultRepositoryLayout() );
+        return artifactRepositoryFactory.createArtifactRepository( id, url, new DefaultRepositoryLayout(), null, null );
     }
 
     /**
@@ -369,11 +368,9 @@
     public void xtestChecksumVerification()
         throws Exception
     {
-        ArtifactRepositoryPolicy policy =
-            new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS,
-                                          ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL );
-        ArtifactRepository repo =
-            new DefaultArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub(), policy, policy );
+        ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( true, ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, ArtifactRepositoryPolicy.CHECKSUM_POLICY_FAIL );
+        
+        ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( "id", "string://url", new ArtifactRepositoryLayoutStub(), policy, policy );
 
         Artifact artifact =
             new DefaultArtifact( "sample.group", "sample-art", VersionRange.createFromVersion( "1.0" ), "scope",

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java Sun Jun 21 11:39:10 2009
@@ -32,6 +32,7 @@
 import org.apache.maven.artifact.ArtifactUtils;
 import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.versioning.VersionRange;
@@ -62,12 +63,14 @@
     private static final String FS = System.getProperty( "file.separator" );
 
     private ArtifactFactory factory;
+    private ArtifactRepositoryFactory artifactRepositoryFactory;
 
     public void setUp()
         throws Exception
     {
         super.setUp();
         factory = lookup( ArtifactFactory.class );        
+        artifactRepositoryFactory = lookup( ArtifactRepositoryFactory.class );        
     }
     
     @Override
@@ -343,7 +346,7 @@
             createExpressionEvaluator( createDefaultProject(), null, new Properties() );
         Object value = expressionEvaluator.evaluate( "${localRepository}" );
 
-        assertEquals( "local", ( (DefaultArtifactRepository) value ).getId() );
+        assertEquals( "local", ( (ArtifactRepository) value ).getId() );
     }
 
     public void testTwoExpressions()
@@ -398,7 +401,7 @@
     {
         ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
 
-        ArtifactRepository repo = new DefaultArtifactRepository( "local", "target/repo", repoLayout );
+        ArtifactRepository repo = artifactRepositoryFactory.createArtifactRepository( "local", "target/repo", repoLayout, null, null );
 
         MutablePlexusContainer container = (MutablePlexusContainer) getContainer();
         MavenSession session = createSession( container, repo, executionProperties );

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java Sun Jun 21 11:39:10 2009
@@ -26,6 +26,7 @@
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.model.validation.ModelValidationResult;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.PlexusTestCase;
 
 /**
@@ -37,11 +38,13 @@
 {
     protected ProjectBuilder projectBuilder;
 
+    protected RepositorySystem repositorySystem;
+    
     protected void setUp()
         throws Exception
     {
         super.setUp();
-
+        
         if ( getContainer().hasComponent( ProjectBuilder.class, "test" ) )
         {
             projectBuilder = lookup( ProjectBuilder.class, "test" );
@@ -51,6 +54,8 @@
             // default over to the main project builder...
             projectBuilder = lookup( ProjectBuilder.class );
         }
+        
+        repositorySystem = lookup( RepositorySystem.class );        
     }    
 
     @Override
@@ -70,7 +75,9 @@
     @Override
     protected String getCustomConfigurationName()
     {
-        return AbstractMavenProjectTestCase.class.getName().replace( '.', '/' ) + ".xml";
+        String name = AbstractMavenProjectTestCase.class.getName().replace( '.', '/' ) + ".xml";
+        System.out.println( name );
+        return name;
     }
 
     // ----------------------------------------------------------------------
@@ -105,7 +112,7 @@
     {
         ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
 
-        ArtifactRepository r = new DefaultArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout );
+        ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null );
 
         return r;
     }

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java Sun Jun 21 11:39:10 2009
@@ -111,7 +111,7 @@
         throws Exception
     {
         ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
-        ArtifactRepository r = new DefaultArtifactRepository( "local", "file://" + localRepoDir.getAbsolutePath(), repoLayout );
+        ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + localRepoDir.getAbsolutePath(), repoLayout, null, null );
         return r;
     }
     

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java Sun Jun 21 11:39:10 2009
@@ -29,6 +29,7 @@
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.project.harness.PomTestWrapper;
+import org.apache.maven.repository.RepositorySystem;
 import org.codehaus.plexus.PlexusTestCase;
 
 public class PomConstructionTest
@@ -41,7 +42,9 @@
     private static String BASE_MIXIN_DIR = BASE_DIR + "/resources-mixins";
 
     private DefaultProjectBuilder projectBuilder;
-
+    
+    private RepositorySystem repositorySystem;
+    
     private File testDirectory;
 
     protected void setUp()
@@ -50,6 +53,7 @@
         testDirectory = new File( getBasedir(), BASE_POM_DIR );
         new File( getBasedir(), BASE_MIXIN_DIR );
         projectBuilder = (DefaultProjectBuilder) lookup( ProjectBuilder.class );
+        repositorySystem = lookup( RepositorySystem.class );
     }
     
     @Override
@@ -1671,7 +1675,7 @@
         String localRepoUrl =
             System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
         localRepoUrl = "file://" + localRepoUrl;
-        config.setLocalRepository( new DefaultArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout() ) );
+        config.setLocalRepository( repositorySystem.createArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(), null, null ) );
         config.setActiveProfileIds( Arrays.asList( profileIds ) );
         config.setExecutionProperties( executionProperties );
         config.setLenientValidation( lenientValidation );

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/project/ProjectClasspathTest.java Sun Jun 21 11:39:10 2009
@@ -23,6 +23,7 @@
 import java.util.Iterator;
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.repository.RepositorySystem;
 
 public class ProjectClasspathTest
     extends AbstractMavenProjectTestCase
@@ -36,6 +37,8 @@
 
         // the metadata source looks up the default impl, so we have to trick it
         getContainer().addComponent( projectBuilder, ProjectBuilder.class, "default" );
+        
+        repositorySystem = lookup( RepositorySystem.class );        
     }
    
     @Override

Modified: maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java (original)
+++ maven/components/trunk/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java Sun Jun 21 11:39:10 2009
@@ -12,6 +12,7 @@
 import org.apache.maven.project.ProjectBuilder;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.project.harness.PomTestWrapper;
+import org.apache.maven.repository.RepositorySystem;
 import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.util.IOUtil;
@@ -26,6 +27,8 @@
     private static String BASE_POM_DIR = BASE_DIR + "/resources-settings";
 
     private DefaultProjectBuilder projectBuilder;
+    
+    private RepositorySystem repositorySystem;
 
     private File testDirectory;
 
@@ -34,6 +37,7 @@
     {
         testDirectory = new File( getBasedir(), BASE_POM_DIR );
         projectBuilder = (DefaultProjectBuilder) lookup( ProjectBuilder.class );
+        repositorySystem = lookup( RepositorySystem.class );
     }
 
     @Override
@@ -83,7 +87,7 @@
 	    
         String localRepoUrl = System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
         localRepoUrl = "file://" + localRepoUrl;
-        config.setLocalRepository( new DefaultArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout() ) );
+        config.setLocalRepository( repositorySystem.createArtifactRepository( "local", localRepoUrl, new DefaultRepositoryLayout(), null, null ) );
         config.setActiveProfileIds( settings.getActiveProfiles() );
         
         return new PomTestWrapper( pomFile, projectBuilder.build( pomFile, config ) );        

Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DefaultMirrorBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DefaultMirrorBuilder.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DefaultMirrorBuilder.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DefaultMirrorBuilder.java Sun Jun 21 11:39:10 2009
@@ -29,6 +29,7 @@
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
 import org.codehaus.plexus.logging.Logger;
@@ -60,7 +61,7 @@
             logger.warn( "You are using a mirror that doesn't declare an <id/> element. Using \'" + id + "\' instead:\nId: " + id + "\nmirrorOf: " + mirrorOf + "\nurl: " + url + "\n" );
         }
 
-        ArtifactRepository mirror = new DefaultArtifactRepository( id, url, null );
+        ArtifactRepository mirror = repositoryFactory.createArtifactRepository( id, url, (ArtifactRepositoryLayout)null, null, null );
 
         if ( !mirrors.containsKey( mirrorOf ) )
         {

Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/DelegatingLocalArtifactRepository.java Sun Jun 21 11:39:10 2009
@@ -23,7 +23,7 @@
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 
 /**
@@ -31,7 +31,7 @@
  * and user local repository.
  */
 public class DelegatingLocalArtifactRepository
-    extends DefaultArtifactRepository
+    extends MavenArtifactRepository
 {
     private LocalArtifactRepository buildReactor;
 

Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/LocalArtifactRepository.java Sun Jun 21 11:39:10 2009
@@ -21,9 +21,10 @@
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
+import org.apache.maven.artifact.repository.MavenArtifactRepository;
 
 public abstract class LocalArtifactRepository
-    extends DefaultArtifactRepository
+    extends MavenArtifactRepository
 {   
     public static final String IDE_WORKSPACE = "ide-workspace";
 

Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/RepositorySystem.java Sun Jun 21 11:39:10 2009
@@ -25,6 +25,8 @@
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.InvalidRepositoryException;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
 import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
 import org.apache.maven.model.Dependency;
@@ -75,6 +77,8 @@
     ArtifactRepository createLocalRepository( File localRepository )
         throws InvalidRepositoryException;
 
+    ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases );
+    
     /**
      * Calculates the effective repositories for the given input repositories. This process will essentially remove
      * duplicate repositories by merging them into one equivalent repository. It is worth to point out that merging does

Modified: maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java (original)
+++ maven/components/trunk/maven-repository/src/main/java/org/apache/maven/repository/legacy/LegacyRepositorySystem.java Sun Jun 21 11:39:10 2009
@@ -299,6 +299,11 @@
         return artifactRepositoryFactory.createArtifactRepository( repositoryId, url, defaultArtifactRepositoryLayout, snapshotsPolicy, releasesPolicy );
     }
 
+    public ArtifactRepository createArtifactRepository( String id, String url, ArtifactRepositoryLayout repositoryLayout, ArtifactRepositoryPolicy snapshots, ArtifactRepositoryPolicy releases )
+    {
+        return artifactRepositoryFactory.createArtifactRepository( id, url, repositoryLayout, snapshots, releases );
+    }
+    
     public ArtifactResolutionResult resolve( ArtifactResolutionRequest request )
     {
         /*

Modified: maven/components/trunk/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java?rev=786995&r1=786994&r2=786995&view=diff
==============================================================================
--- maven/components/trunk/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java (original)
+++ maven/components/trunk/maven-repository/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java Sun Jun 21 11:39:10 2009
@@ -1,6 +1,7 @@
 package org.apache.maven.repository;
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.DefaultArtifactRepository;
 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
 import org.codehaus.plexus.PlexusTestCase;
@@ -9,11 +10,13 @@
     extends PlexusTestCase
 {
     private DefaultMirrorBuilder mirrorBuilder;
+    private ArtifactRepositoryFactory repositorySystem;
     
     protected void setUp()
         throws Exception
     {
         mirrorBuilder = (DefaultMirrorBuilder) lookup( MirrorBuilder.class );
+        repositorySystem = lookup( ArtifactRepositoryFactory.class );
         mirrorBuilder.clearMirrors();
     }
     
@@ -179,7 +182,7 @@
      */
     private ArtifactRepository getRepo( String id, String url )
     {
-        return new DefaultArtifactRepository( id, url, new DefaultRepositoryLayout() );
+        return repositorySystem.createArtifactRepository( id, url, new DefaultRepositoryLayout(), null, null );
     }
 
     /**



Mime
View raw message