[MNG-4494] allow custom ArtifactRepository configuration and implementation

Issue id: MNG-4494


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@891083 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Igor Fedorenko 2009-12-16 00:34:19 +00:00
parent 109f5dab66
commit 837eb821f1
3 changed files with 44 additions and 1 deletions

View File

@ -22,6 +22,7 @@ package org.apache.maven.artifact.repository.layout;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
/** @author jdcasey */
public interface ArtifactRepositoryLayout

View File

@ -0,0 +1,31 @@
package org.apache.maven.artifact.repository.layout;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
/*
* 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.
*/
public interface ArtifactRepositoryLayout2
extends ArtifactRepositoryLayout
{
ArtifactRepository newMavenArtifactRepository( String id, String url, ArtifactRepositoryPolicy snapshots,
ArtifactRepositoryPolicy releases );
}

View File

@ -26,6 +26,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.MavenArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
@ -124,7 +125,17 @@ public class DefaultArtifactRepositoryFactory
releases.setChecksumPolicy( globalChecksumPolicy );
}
ArtifactRepository repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
ArtifactRepository repository;
if ( repositoryLayout instanceof ArtifactRepositoryLayout2 )
{
repository =
( (ArtifactRepositoryLayout2) repositoryLayout ).newMavenArtifactRepository( id, url, snapshots,
releases );
}
else
{
repository = new MavenArtifactRepository( id, url, repositoryLayout, snapshots, releases );
}
return repository;
}