removed ArtifactBasicMetadata

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@751168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Gusakov 2009-03-07 01:39:48 +00:00
parent 30e6002f40
commit a2f8c435c8
5 changed files with 35 additions and 37 deletions

View File

@ -25,7 +25,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.maven.mercury.artifact.ArtifactBasicMetadata; import org.apache.maven.mercury.artifact.ArtifactMetadata;
import org.apache.maven.mercury.builder.api.DependencyProcessor; import org.apache.maven.mercury.builder.api.DependencyProcessor;
import org.apache.maven.mercury.builder.api.DependencyProcessorException; import org.apache.maven.mercury.builder.api.DependencyProcessorException;
import org.apache.maven.mercury.builder.api.MetadataReader; import org.apache.maven.mercury.builder.api.MetadataReader;
@ -52,7 +52,7 @@ import org.codehaus.plexus.component.annotations.Component;
public final class MavenDependencyProcessor public final class MavenDependencyProcessor
implements DependencyProcessor implements DependencyProcessor
{ {
public List<ArtifactBasicMetadata> getDependencies( ArtifactBasicMetadata bmd, MetadataReader mdReader, Map system, public List<ArtifactMetadata> getDependencies( ArtifactMetadata bmd, MetadataReader mdReader, Map system,
Map user ) Map user )
throws MetadataReaderException, DependencyProcessorException throws MetadataReaderException, DependencyProcessorException
{ {

View File

@ -27,15 +27,14 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.apache.maven.mercury.artifact.ArtifactBasicMetadata; import org.apache.maven.mercury.artifact.ArtifactMetadata;
import org.apache.maven.project.builder.factories.ArtifactModelContainerFactory; import org.apache.maven.project.builder.PomClassicDomainModel;
import org.apache.maven.project.builder.factories.ExclusionModelContainerFactory;
import org.apache.maven.project.builder.PomTransformer; import org.apache.maven.project.builder.PomTransformer;
import org.apache.maven.project.builder.ProjectUri; import org.apache.maven.project.builder.ProjectUri;
import org.apache.maven.project.builder.PomClassicDomainModel; import org.apache.maven.project.builder.factories.ArtifactModelContainerFactory;
import org.apache.maven.project.builder.factories.ExclusionModelContainerFactory;
import org.apache.maven.project.builder.profile.ProfileContext; import org.apache.maven.project.builder.profile.ProfileContext;
import org.apache.maven.shared.model.DataSourceException; import org.apache.maven.shared.model.DataSourceException;
import org.apache.maven.shared.model.DomainModel;
import org.apache.maven.shared.model.InterpolatorProperty; import org.apache.maven.shared.model.InterpolatorProperty;
import org.apache.maven.shared.model.ModelContainer; import org.apache.maven.shared.model.ModelContainer;
import org.apache.maven.shared.model.ModelDataSource; import org.apache.maven.shared.model.ModelDataSource;
@ -60,7 +59,7 @@ public final class MavenDomainModel
*/ */
private String eventHistory; private String eventHistory;
private ArtifactBasicMetadata parentMetadata; private ArtifactMetadata parentMetadata;
/** /**
* Constructor * Constructor
@ -102,10 +101,10 @@ public final class MavenDomainModel
return getParentMetadata() != null; return getParentMetadata() != null;
} }
public List<ArtifactBasicMetadata> getDependencyMetadata() public List<ArtifactMetadata> getDependencyMetadata()
throws DataSourceException throws DataSourceException
{ {
List<ArtifactBasicMetadata> metadatas = new ArrayList<ArtifactBasicMetadata>(); List<ArtifactMetadata> metadatas = new ArrayList<ArtifactMetadata>();
ModelDataSource source = new DefaultModelDataSource( modelProperties, PomTransformer.MODEL_CONTAINER_FACTORIES ); ModelDataSource source = new DefaultModelDataSource( modelProperties, PomTransformer.MODEL_CONTAINER_FACTORIES );
for ( ModelContainer modelContainer : source.queryFor( ProjectUri.Dependencies.Dependency.xUri ) ) for ( ModelContainer modelContainer : source.queryFor( ProjectUri.Dependencies.Dependency.xUri ) )
@ -124,7 +123,7 @@ public final class MavenDomainModel
return new ProfileContext( dataSource, null, null, properties ).getActiveProfiles(); return new ProfileContext( dataSource, null, null, properties ).getActiveProfiles();
} }
public ArtifactBasicMetadata getParentMetadata() public ArtifactMetadata getParentMetadata()
{ {
if ( parentMetadata != null ) if ( parentMetadata != null )
{ {
@ -157,7 +156,7 @@ public final class MavenDomainModel
{ {
return null; return null;
} }
parentMetadata = new ArtifactBasicMetadata(); parentMetadata = new ArtifactMetadata();
parentMetadata.setArtifactId( artifactId ); parentMetadata.setArtifactId( artifactId );
parentMetadata.setVersion( version ); parentMetadata.setVersion( version );
parentMetadata.setGroupId( groupId ); parentMetadata.setGroupId( groupId );
@ -165,9 +164,9 @@ public final class MavenDomainModel
return copyArtifactBasicMetadata( parentMetadata ); return copyArtifactBasicMetadata( parentMetadata );
} }
private ArtifactBasicMetadata copyArtifactBasicMetadata( ArtifactBasicMetadata metadata ) private ArtifactMetadata copyArtifactBasicMetadata( ArtifactMetadata metadata )
{ {
ArtifactBasicMetadata amd = new ArtifactBasicMetadata(); ArtifactMetadata amd = new ArtifactMetadata();
amd.setArtifactId( metadata.getArtifactId() ); amd.setArtifactId( metadata.getArtifactId() );
amd.setGroupId( metadata.getGroupId() ); amd.setGroupId( metadata.getGroupId() );
amd.setVersion( metadata.getVersion() ); amd.setVersion( metadata.getVersion() );
@ -200,12 +199,12 @@ public final class MavenDomainModel
return new ArrayList<ModelProperty>( modelProperties ); return new ArrayList<ModelProperty>( modelProperties );
} }
private ArtifactBasicMetadata transformContainerToMetadata( ModelContainer container ) private ArtifactMetadata transformContainerToMetadata( ModelContainer container )
throws DataSourceException throws DataSourceException
{ {
List<ModelProperty> modelProperties = container.getProperties(); List<ModelProperty> modelProperties = container.getProperties();
ArtifactBasicMetadata metadata = new ArtifactBasicMetadata(); ArtifactMetadata metadata = new ArtifactMetadata();
for ( ModelProperty mp : modelProperties ) for ( ModelProperty mp : modelProperties )
{ {
if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.groupId ) ) if ( mp.getUri().equals( ProjectUri.Dependencies.Dependency.groupId ) )
@ -245,11 +244,11 @@ public final class MavenDomainModel
ModelDataSource dataSource = new DefaultModelDataSource( container.getProperties(), Arrays.asList( new ArtifactModelContainerFactory(), ModelDataSource dataSource = new DefaultModelDataSource( container.getProperties(), Arrays.asList( new ArtifactModelContainerFactory(),
new ExclusionModelContainerFactory() ) ); new ExclusionModelContainerFactory() ) );
List<ArtifactBasicMetadata> exclusions = new ArrayList<ArtifactBasicMetadata>(); List<ArtifactMetadata> exclusions = new ArrayList<ArtifactMetadata>();
for ( ModelContainer exclusion : dataSource.queryFor( ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.xUri ) ) for ( ModelContainer exclusion : dataSource.queryFor( ProjectUri.Dependencies.Dependency.Exclusions.Exclusion.xUri ) )
{ {
ArtifactBasicMetadata meta = new ArtifactBasicMetadata(); ArtifactMetadata meta = new ArtifactMetadata();
exclusions.add( meta ); exclusions.add( meta );
for ( ModelProperty mp : exclusion.getProperties() ) for ( ModelProperty mp : exclusion.getProperties() )

View File

@ -19,12 +19,12 @@ package org.apache.maven.mercury;
* under the License. * under the License.
*/ */
import org.apache.maven.shared.model.DomainModelFactory;
import org.apache.maven.shared.model.DomainModel;
import org.apache.maven.shared.model.ModelProperty;
import java.util.List;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import org.apache.maven.shared.model.DomainModel;
import org.apache.maven.shared.model.DomainModelFactory;
import org.apache.maven.shared.model.ModelProperty;
public class MavenDomainModelFactory public class MavenDomainModelFactory
implements DomainModelFactory implements DomainModelFactory

View File

@ -1,16 +1,16 @@
package org.apache.maven.mercury; package org.apache.maven.mercury;
import org.apache.maven.mercury.builder.api.MetadataReaderException;
import org.apache.maven.mercury.builder.api.MetadataReader;
import org.apache.maven.mercury.artifact.ArtifactBasicMetadata;
import org.apache.maven.shared.model.ModelProperty;
import java.util.Map;
import java.util.List; import java.util.List;
import java.util.Map;
import org.apache.maven.mercury.artifact.ArtifactMetadata;
import org.apache.maven.mercury.builder.api.MetadataReader;
import org.apache.maven.mercury.builder.api.MetadataReaderException;
import org.apache.maven.shared.model.ModelProperty;
public interface PomProcessor public interface PomProcessor
{ {
List<ModelProperty> getRawPom(ArtifactBasicMetadata bmd, MetadataReader mdReader, Map<String, String> env, List<ModelProperty> getRawPom(ArtifactMetadata bmd, MetadataReader mdReader, Map<String, String> env,
Map<String, String> sysProps) Map<String, String> sysProps)
throws MetadataReaderException, PomProcessorException; throws MetadataReaderException, PomProcessorException;
} }

View File

@ -10,7 +10,7 @@ import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.maven.mercury.artifact.ArtifactBasicMetadata; import org.apache.maven.mercury.artifact.ArtifactMetadata;
import org.apache.maven.mercury.metadata.DependencyBuilder; import org.apache.maven.mercury.metadata.DependencyBuilder;
import org.apache.maven.mercury.metadata.DependencyBuilderFactory; import org.apache.maven.mercury.metadata.DependencyBuilderFactory;
import org.apache.maven.mercury.repository.api.ArtifactBasicResults; import org.apache.maven.mercury.repository.api.ArtifactBasicResults;
@ -18,7 +18,6 @@ import org.apache.maven.mercury.repository.api.Repository;
import org.apache.maven.mercury.repository.api.RepositoryReader; import org.apache.maven.mercury.repository.api.RepositoryReader;
import org.apache.maven.mercury.repository.local.m2.LocalRepositoryM2; import org.apache.maven.mercury.repository.local.m2.LocalRepositoryM2;
import org.apache.maven.mercury.repository.remote.m2.RemoteRepositoryM2; import org.apache.maven.mercury.repository.remote.m2.RemoteRepositoryM2;
//import org.apache.maven.mercury.spi.http.server.HttpTestServer;
import org.apache.maven.mercury.transport.api.Server; import org.apache.maven.mercury.transport.api.Server;
import org.apache.maven.mercury.util.FileUtil; import org.apache.maven.mercury.util.FileUtil;
import org.junit.After; import org.junit.After;
@ -111,7 +110,7 @@ public class MavenDependencyProcessorTest
} }
/** /**
* Test method for {@link org.apache.maven.mercury.MavenDependencyProcessor#getDependencies(org.apache.maven.mercury.artifact.ArtifactBasicMetadata, org.apache.maven.mercury.builder.api.MetadataReader, java.util.Map, java.util.Map)}. * Test method for {@link org.apache.maven.mercury.MavenDependencyProcessor#getDependencies(org.apache.maven.mercury.artifact.ArtifactMetadata, org.apache.maven.mercury.builder.api.MetadataReader, java.util.Map, java.util.Map)}.
*/ */
public void testMavenVersion() public void testMavenVersion()
throws Exception throws Exception
@ -120,8 +119,8 @@ public class MavenDependencyProcessorTest
String gav = "org.apache.maven.plugins:maven-dependency-plugin:2.0"; String gav = "org.apache.maven.plugins:maven-dependency-plugin:2.0";
ArtifactBasicMetadata bmd = new ArtifactBasicMetadata( gav ); ArtifactMetadata bmd = new ArtifactMetadata( gav );
ArrayList<ArtifactBasicMetadata> query = new ArrayList<ArtifactBasicMetadata>(1); ArrayList<ArtifactMetadata> query = new ArrayList<ArtifactMetadata>(1);
query.add( bmd ); query.add( bmd );
ArtifactBasicResults res = rr.readDependencies( query ); ArtifactBasicResults res = rr.readDependencies( query );
@ -132,7 +131,7 @@ public class MavenDependencyProcessorTest
assertTrue( res.hasResults() ); assertTrue( res.hasResults() );
List<ArtifactBasicMetadata> deps = res.getResult( bmd ); List<ArtifactMetadata> deps = res.getResult( bmd );
assertNotNull( deps ); assertNotNull( deps );
@ -140,7 +139,7 @@ public class MavenDependencyProcessorTest
System.out.println(deps); System.out.println(deps);
for( ArtifactBasicMetadata md : deps ) for( ArtifactMetadata md : deps )
if( "${maven.version}".equals( md.getVersion() ) ) if( "${maven.version}".equals( md.getVersion() ) )
fail( "dependency has unresolved variable: "+md.toString() ); fail( "dependency has unresolved variable: "+md.toString() );
} }