git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755296 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.2
@@ -19,15 +19,14 @@ package org.apache.maven.archiva.repository.content; | |||
* under the License. | |||
*/ | |||
import java.util.Collection; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | |||
import org.apache.maven.archiva.configuration.LegacyArtifactPath; | |||
import org.apache.maven.archiva.model.ArtifactReference; | |||
import org.apache.maven.archiva.repository.layout.LayoutException; | |||
import java.util.Collection; | |||
import java.util.Iterator; | |||
/** | |||
* LegacyPathParser is a parser for maven 1 (legacy layout) paths to | |||
* ArtifactReference. | |||
@@ -58,10 +57,9 @@ public class LegacyPathParser | |||
ArtifactReference artifact = new ArtifactReference(); | |||
// First, look if a custom resolution rule has been set for this artifact | |||
Collection legacy = configuration.getConfiguration().getLegacyArtifactPaths(); | |||
for ( Iterator iterator = legacy.iterator(); iterator.hasNext(); ) | |||
Collection<LegacyArtifactPath> legacy = configuration.getConfiguration().getLegacyArtifactPaths(); | |||
for ( LegacyArtifactPath legacyPath : legacy ) | |||
{ | |||
LegacyArtifactPath legacyPath = (LegacyArtifactPath) iterator.next(); | |||
if ( legacyPath.match( path ) ) | |||
{ | |||
artifact.setGroupId( legacyPath.getGroupId() ); |
@@ -21,7 +21,6 @@ package org.apache.maven.archiva.repository.events; | |||
import java.util.List; | |||
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; | |||
import org.springframework.beans.BeansException; | |||
import org.springframework.beans.factory.FactoryBean; | |||
import org.springframework.context.ApplicationContext; | |||
@@ -49,7 +48,8 @@ public class RepositoryListenerFactoryBean | |||
return applicationContext.getBeansOfType( RepositoryListener.class ).values(); | |||
} | |||
public Class getObjectType() | |||
@SuppressWarnings("unchecked") | |||
public Class<List> getObjectType() | |||
{ | |||
return List.class; | |||
} |
@@ -20,14 +20,13 @@ package org.apache.maven.archiva.repository.metadata; | |||
*/ | |||
import java.util.ArrayList; | |||
import org.apache.maven.archiva.model.ArchivaModelCloner; | |||
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; | |||
import org.apache.maven.archiva.model.SnapshotVersion; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.maven.archiva.model.ArchivaModelCloner; | |||
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata; | |||
import org.apache.maven.archiva.model.Plugin; | |||
import org.apache.maven.archiva.model.SnapshotVersion; | |||
/** | |||
* RepositoryMetadataMerge | |||
@@ -170,7 +169,7 @@ public class RepositoryMetadataMerge | |||
return main; | |||
} | |||
private static List mergePlugins(List mainPlugins, List sourcePlugins) | |||
private static List<Plugin> mergePlugins(List<Plugin> mainPlugins, List<Plugin> sourcePlugins) | |||
{ | |||
if ( sourcePlugins == null ) | |||
{ | |||
@@ -182,12 +181,10 @@ public class RepositoryMetadataMerge | |||
return clonePlugins( sourcePlugins ); | |||
} | |||
List merged = clonePlugins( mainPlugins ); | |||
List<Plugin> merged = clonePlugins( mainPlugins ); | |||
Iterator it = sourcePlugins.iterator(); | |||
while ( it.hasNext() ) | |||
for ( Plugin plugin : sourcePlugins ) | |||
{ | |||
Plugin plugin = (Plugin) it.next(); | |||
if ( !merged.contains( plugin ) ) | |||
{ | |||
merged.add( plugin ); | |||
@@ -213,7 +210,7 @@ public class RepositoryMetadataMerge | |||
return null; | |||
} | |||
ArrayList result = new ArrayList(); | |||
List<Plugin> result = new ArrayList<Plugin>(); | |||
for (Plugin plugin : plugins) | |||
{ | |||
@@ -227,7 +224,7 @@ public class RepositoryMetadataMerge | |||
return result; | |||
} | |||
private static List mergeAvailableVersions( List mainAvailableVersions, List sourceAvailableVersions ) | |||
private static List<String> mergeAvailableVersions( List<String> mainAvailableVersions, List<String> sourceAvailableVersions ) | |||
{ | |||
if ( sourceAvailableVersions == null ) | |||
{ | |||
@@ -239,12 +236,10 @@ public class RepositoryMetadataMerge | |||
return ArchivaModelCloner.cloneAvailableVersions( sourceAvailableVersions ); | |||
} | |||
List merged = ArchivaModelCloner.cloneAvailableVersions( mainAvailableVersions ); | |||
List<String> merged = ArchivaModelCloner.cloneAvailableVersions( mainAvailableVersions ); | |||
Iterator it = sourceAvailableVersions.iterator(); | |||
while ( it.hasNext() ) | |||
for ( String sourceVersion : sourceAvailableVersions ) | |||
{ | |||
String sourceVersion = (String) it.next(); | |||
if ( !merged.contains( sourceVersion ) ) | |||
{ | |||
merged.add( sourceVersion ); |
@@ -19,6 +19,16 @@ package org.apache.maven.archiva.repository.project; | |||
* under the License. | |||
*/ | |||
import java.util.ArrayList; | |||
import java.util.Enumeration; | |||
import java.util.HashMap; | |||
import java.util.HashSet; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Properties; | |||
import java.util.Set; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.maven.archiva.model.ArchivaModelCloner; | |||
import org.apache.maven.archiva.model.ArchivaProjectModel; | |||
@@ -33,17 +43,6 @@ import org.apache.maven.archiva.model.Organization; | |||
import org.apache.maven.archiva.model.ProjectRepository; | |||
import org.apache.maven.archiva.model.Scm; | |||
import java.util.ArrayList; | |||
import java.util.Enumeration; | |||
import java.util.HashMap; | |||
import java.util.HashSet; | |||
import java.util.Iterator; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Properties; | |||
import java.util.Set; | |||
import java.util.Map.Entry; | |||
/** | |||
* ProjectModelMerge | |||
* | |||
@@ -107,14 +106,12 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
private static Map createArtifactReferenceMap( List artifactReferences ) | |||
private static Map<String, ArtifactReference> createArtifactReferenceMap( List<ArtifactReference> artifactReferences ) | |||
{ | |||
Map ret = new HashMap(); | |||
Map<String, ArtifactReference> ret = new HashMap<String, ArtifactReference>(); | |||
Iterator it = artifactReferences.iterator(); | |||
while ( it.hasNext() ) | |||
for ( ArtifactReference artifactReference : artifactReferences ) | |||
{ | |||
ArtifactReference artifactReference = (ArtifactReference) it.next(); | |||
String key = toVersionlessArtifactKey( artifactReference ); | |||
ret.put( key, artifactReference ); | |||
} | |||
@@ -122,14 +119,14 @@ public class ProjectModelMerge | |||
return ret; | |||
} | |||
private static Map createDependencyMap( List dependencies ) | |||
private static Map<String, Dependency> createDependencyMap( List<Dependency> dependencies ) | |||
{ | |||
Map ret = new HashMap(); | |||
Map<String, Dependency> ret = new HashMap<String, Dependency>(); | |||
Iterator it = dependencies.iterator(); | |||
Iterator<Dependency> it = dependencies.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
Dependency dep = (Dependency) it.next(); | |||
Dependency dep = it.next(); | |||
String key = toVersionlessDependencyKey( dep ); | |||
ret.put( key, dep ); | |||
} | |||
@@ -137,14 +134,14 @@ public class ProjectModelMerge | |||
return ret; | |||
} | |||
private static Map createExclusionMap( List exclusions ) | |||
private static Map<String, Exclusion> createExclusionMap( List<Exclusion> exclusions ) | |||
{ | |||
Map ret = new HashMap(); | |||
Map<String, Exclusion> ret = new HashMap<String, Exclusion>(); | |||
Iterator it = exclusions.iterator(); | |||
Iterator<Exclusion> it = exclusions.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
Exclusion exclusion = (Exclusion) it.next(); | |||
Exclusion exclusion = it.next(); | |||
String key = exclusion.getGroupId() + ":" + exclusion.getArtifactId(); | |||
ret.put( key, exclusion ); | |||
} | |||
@@ -152,14 +149,12 @@ public class ProjectModelMerge | |||
return ret; | |||
} | |||
private static Map createLicensesMap( List licenses ) | |||
private static Map<String, License> createLicensesMap( List<License> licenses ) | |||
{ | |||
Map ret = new HashMap(); | |||
Map<String, License> ret = new HashMap<String, License>(); | |||
Iterator it = licenses.iterator(); | |||
while ( it.hasNext() ) | |||
for ( License license : licenses ) | |||
{ | |||
License license = (License) it.next(); | |||
// TODO: Change to 'id' when LicenseTypeMapper is created. | |||
String key = license.getName(); | |||
ret.put( key, license ); | |||
@@ -168,14 +163,12 @@ public class ProjectModelMerge | |||
return ret; | |||
} | |||
private static Map createRepositoriesMap( List repositories ) | |||
private static Map<String, ProjectRepository> createRepositoriesMap( List<ProjectRepository> repositories ) | |||
{ | |||
Map ret = new HashMap(); | |||
Map<String, ProjectRepository> ret = new HashMap<String, ProjectRepository>(); | |||
Iterator it = repositories.iterator(); | |||
while ( it.hasNext() ) | |||
for ( ProjectRepository repo : repositories ) | |||
{ | |||
ProjectRepository repo = (ProjectRepository) it.next(); | |||
// Should this really be using repo.id ? | |||
String key = repo.getUrl(); | |||
ret.put( key, repo ); | |||
@@ -321,6 +314,7 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private static Properties merge( Properties mainProperties, Properties parentProperties ) | |||
{ | |||
if ( parentProperties == null ) | |||
@@ -336,7 +330,7 @@ public class ProjectModelMerge | |||
Properties merged = new Properties(); | |||
merged.putAll(mainProperties); | |||
Enumeration keys = parentProperties.propertyNames(); | |||
Enumeration<String> keys = (Enumeration<String>) parentProperties.propertyNames(); | |||
while ( keys.hasMoreElements() ) | |||
{ | |||
String key = (String) keys.nextElement(); | |||
@@ -377,7 +371,7 @@ public class ProjectModelMerge | |||
return main; | |||
} | |||
private static List mergeArtifactReferences( List mainArtifactReferences, List parentArtifactReferences ) | |||
private static List<ArtifactReference> mergeArtifactReferences( List<ArtifactReference> mainArtifactReferences, List<ArtifactReference> parentArtifactReferences ) | |||
{ | |||
if ( parentArtifactReferences == null ) | |||
{ | |||
@@ -386,21 +380,19 @@ public class ProjectModelMerge | |||
if ( mainArtifactReferences == null ) | |||
{ | |||
return ArchivaModelCloner.cloneLicenses( parentArtifactReferences ); | |||
return ArchivaModelCloner.cloneArtifactReferences( parentArtifactReferences ); | |||
} | |||
List merged = new ArrayList(); | |||
List<ArtifactReference> merged = new ArrayList<ArtifactReference>(); | |||
Map mainArtifactReferenceMap = createArtifactReferenceMap( mainArtifactReferences ); | |||
Map parentArtifactReferenceMap = createArtifactReferenceMap( parentArtifactReferences ); | |||
Map<String, ArtifactReference> mainArtifactReferenceMap = createArtifactReferenceMap( mainArtifactReferences ); | |||
Map<String, ArtifactReference> parentArtifactReferenceMap = createArtifactReferenceMap( parentArtifactReferences ); | |||
Iterator it = mainArtifactReferenceMap.entrySet().iterator(); | |||
while ( it.hasNext() ) | |||
for ( Map.Entry<String,ArtifactReference> entry : mainArtifactReferenceMap.entrySet() ) | |||
{ | |||
Map.Entry entry = (Entry) it.next(); | |||
String key = (String) entry.getKey(); | |||
String key = entry.getKey(); | |||
ArtifactReference mainArtifactReference = (ArtifactReference) entry.getValue(); | |||
ArtifactReference parentArtifactReference = (ArtifactReference) parentArtifactReferenceMap.get( key ); | |||
ArtifactReference parentArtifactReference = parentArtifactReferenceMap.get( key ); | |||
if ( parentArtifactReference == null ) | |||
{ | |||
@@ -416,7 +408,7 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
private static List mergeDependencies( List mainDependencies, List parentDependencies ) | |||
private static List<Dependency> mergeDependencies( List<Dependency> mainDependencies, List<Dependency> parentDependencies ) | |||
{ | |||
if ( parentDependencies == null ) | |||
{ | |||
@@ -425,30 +417,30 @@ public class ProjectModelMerge | |||
if ( mainDependencies == null ) | |||
{ | |||
List merged = ArchivaModelCloner.cloneDependencies( parentDependencies ); | |||
Iterator it = merged.iterator(); | |||
List<Dependency> merged = ArchivaModelCloner.cloneDependencies( parentDependencies ); | |||
Iterator<Dependency> it = merged.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
Dependency dep = (Dependency) it.next(); | |||
Dependency dep = it.next(); | |||
dep.setFromParent( true ); | |||
} | |||
return merged; | |||
} | |||
List merged = new ArrayList(); | |||
List<Dependency> merged = new ArrayList<Dependency>(); | |||
Map mainDepMap = createDependencyMap( mainDependencies ); | |||
Map parentDepMap = createDependencyMap( parentDependencies ); | |||
Set uniqueKeys = new HashSet(); | |||
Map<String, Dependency> mainDepMap = createDependencyMap( mainDependencies ); | |||
Map<String, Dependency> parentDepMap = createDependencyMap( parentDependencies ); | |||
Set<String> uniqueKeys = new HashSet<String>(); | |||
uniqueKeys.addAll( mainDepMap.keySet() ); | |||
uniqueKeys.addAll( parentDepMap.keySet() ); | |||
Iterator it = uniqueKeys.iterator(); | |||
Iterator<String> it = uniqueKeys.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
String key = (String) it.next(); | |||
Dependency parentDep = (Dependency) parentDepMap.get( key ); | |||
Dependency mainDep = (Dependency) mainDepMap.get( key ); | |||
String key = it.next(); | |||
Dependency parentDep = parentDepMap.get( key ); | |||
Dependency mainDep = mainDepMap.get( key ); | |||
if ( parentDep == null ) | |||
{ | |||
@@ -466,7 +458,7 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
private static List mergeDependencyManagement( List mainDepMgmt, List parentDepMgmt ) | |||
private static List<Dependency> mergeDependencyManagement( List<Dependency> mainDepMgmt, List<Dependency> parentDepMgmt ) | |||
{ | |||
if ( parentDepMgmt == null ) | |||
{ | |||
@@ -475,30 +467,30 @@ public class ProjectModelMerge | |||
if ( mainDepMgmt == null ) | |||
{ | |||
List merged = ArchivaModelCloner.cloneDependencies( parentDepMgmt ); | |||
Iterator it = merged.iterator(); | |||
List<Dependency> merged = ArchivaModelCloner.cloneDependencies( parentDepMgmt ); | |||
Iterator<Dependency> it = merged.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
Dependency dep = (Dependency) it.next(); | |||
Dependency dep = it.next(); | |||
dep.setFromParent( true ); | |||
} | |||
return merged; | |||
} | |||
List merged = new ArrayList(); | |||
List<Dependency> merged = new ArrayList<Dependency>(); | |||
Map mainDepMap = createDependencyMap( mainDepMgmt ); | |||
Map parentDepMap = createDependencyMap( parentDepMgmt ); | |||
Set uniqueKeys = new HashSet(); | |||
Map<String, Dependency> mainDepMap = createDependencyMap( mainDepMgmt ); | |||
Map<String, Dependency> parentDepMap = createDependencyMap( parentDepMgmt ); | |||
Set<String> uniqueKeys = new HashSet<String>(); | |||
uniqueKeys.addAll( mainDepMap.keySet() ); | |||
uniqueKeys.addAll( parentDepMap.keySet() ); | |||
Iterator it = uniqueKeys.iterator(); | |||
Iterator<String> it = uniqueKeys.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
String key = (String) it.next(); | |||
Dependency parentDep = (Dependency) parentDepMap.get( key ); | |||
Dependency mainDep = (Dependency) mainDepMap.get( key ); | |||
String key = it.next(); | |||
Dependency parentDep = parentDepMap.get( key ); | |||
Dependency mainDep = mainDepMap.get( key ); | |||
if ( parentDep == null ) | |||
{ | |||
@@ -516,7 +508,7 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
public static List mergeExclusions( List mainExclusions, List parentExclusions ) | |||
public static List<Exclusion> mergeExclusions( List<Exclusion> mainExclusions, List<Exclusion> parentExclusions ) | |||
{ | |||
if ( parentExclusions == null ) | |||
{ | |||
@@ -528,18 +520,16 @@ public class ProjectModelMerge | |||
return ArchivaModelCloner.cloneExclusions( parentExclusions ); | |||
} | |||
List merged = new ArrayList(); | |||
List<Exclusion> merged = new ArrayList<Exclusion>(); | |||
Map mainExclusionMap = createExclusionMap( mainExclusions ); | |||
Map parentExclusionMap = createExclusionMap( parentExclusions ); | |||
Map<String, Exclusion> mainExclusionMap = createExclusionMap( mainExclusions ); | |||
Map<String, Exclusion> parentExclusionMap = createExclusionMap( parentExclusions ); | |||
Iterator it = mainExclusionMap.entrySet().iterator(); | |||
while ( it.hasNext() ) | |||
for ( Map.Entry<String, Exclusion> entry : mainExclusionMap.entrySet() ) | |||
{ | |||
Map.Entry entry = (Entry) it.next(); | |||
String key = (String) entry.getKey(); | |||
Exclusion mainExclusion = (Exclusion) entry.getValue(); | |||
Exclusion parentExclusion = (Exclusion) parentExclusionMap.get( key ); | |||
String key = entry.getKey(); | |||
Exclusion mainExclusion = entry.getValue(); | |||
Exclusion parentExclusion = parentExclusionMap.get( key ); | |||
if ( parentExclusion == null ) | |||
{ | |||
@@ -554,7 +544,7 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
private static List mergeIndividuals( List mainIndividuals, List parentIndividuals ) | |||
private static List<Individual> mergeIndividuals( List<Individual> mainIndividuals, List<Individual> parentIndividuals ) | |||
{ | |||
if ( parentIndividuals == null ) | |||
{ | |||
@@ -566,12 +556,12 @@ public class ProjectModelMerge | |||
return ArchivaModelCloner.cloneIndividuals( parentIndividuals ); | |||
} | |||
List merged = ArchivaModelCloner.cloneIndividuals( mainIndividuals ); | |||
List<Individual> merged = ArchivaModelCloner.cloneIndividuals( mainIndividuals ); | |||
Iterator it = parentIndividuals.iterator(); | |||
Iterator<Individual> it = parentIndividuals.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
Individual parentIndividual = (Individual) it.next(); | |||
Individual parentIndividual = it.next(); | |||
if ( !mainIndividuals.contains( parentIndividual ) ) | |||
{ | |||
@@ -582,7 +572,7 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
private static List mergeLicenses( List mainLicenses, List parentLicenses ) | |||
private static List<License> mergeLicenses( List<License> mainLicenses, List<License> parentLicenses ) | |||
{ | |||
if ( parentLicenses == null ) | |||
{ | |||
@@ -594,18 +584,16 @@ public class ProjectModelMerge | |||
return ArchivaModelCloner.cloneLicenses( parentLicenses ); | |||
} | |||
List merged = new ArrayList(); | |||
List<License> merged = new ArrayList<License>(); | |||
Map mainLicensesMap = createLicensesMap( mainLicenses ); | |||
Map parentLicensesMap = createLicensesMap( parentLicenses ); | |||
Map<String, License> mainLicensesMap = createLicensesMap( mainLicenses ); | |||
Map<String, License> parentLicensesMap = createLicensesMap( parentLicenses ); | |||
Iterator it = mainLicensesMap.entrySet().iterator(); | |||
while ( it.hasNext() ) | |||
for ( Map.Entry<String, License> entry : mainLicensesMap.entrySet() ) | |||
{ | |||
Map.Entry entry = (Entry) it.next(); | |||
String key = (String) entry.getKey(); | |||
License mainLicense = (License) entry.getValue(); | |||
License parentLicense = (License) parentLicensesMap.get( key ); | |||
String key = entry.getKey(); | |||
License mainLicense = entry.getValue(); | |||
License parentLicense = parentLicensesMap.get( key ); | |||
if ( parentLicense == null ) | |||
{ | |||
@@ -621,17 +609,17 @@ public class ProjectModelMerge | |||
return merged; | |||
} | |||
private static List mergePlugins( List mainPlugins, List parentPlugins ) | |||
private static List<ArtifactReference> mergePlugins( List<ArtifactReference> mainPlugins, List<ArtifactReference> parentPlugins ) | |||
{ | |||
return mergeArtifactReferences( mainPlugins, parentPlugins ); | |||
} | |||
private static List mergeReports( List mainReports, List parentReports ) | |||
private static List<ArtifactReference> mergeReports( List<ArtifactReference> mainReports, List<ArtifactReference> parentReports ) | |||
{ | |||
return mergeArtifactReferences( mainReports, parentReports ); | |||
} | |||
private static List mergeRepositories( List mainRepositories, List parentRepositories ) | |||
private static List<ProjectRepository> mergeRepositories( List<ProjectRepository> mainRepositories, List<ProjectRepository> parentRepositories ) | |||
{ | |||
if ( parentRepositories == null ) | |||
{ | |||
@@ -640,21 +628,19 @@ public class ProjectModelMerge | |||
if ( mainRepositories == null ) | |||
{ | |||
return ArchivaModelCloner.cloneLicenses( parentRepositories ); | |||
return ArchivaModelCloner.cloneRepositories( parentRepositories ); | |||
} | |||
List merged = new ArrayList(); | |||
List<ProjectRepository> merged = new ArrayList<ProjectRepository>(); | |||
Map mainRepositoriesMap = createRepositoriesMap( mainRepositories ); | |||
Map parentRepositoriesMap = createRepositoriesMap( parentRepositories ); | |||
Map<String, ProjectRepository> mainRepositoriesMap = createRepositoriesMap( mainRepositories ); | |||
Map<String, ProjectRepository> parentRepositoriesMap = createRepositoriesMap( parentRepositories ); | |||
Iterator it = mainRepositoriesMap.entrySet().iterator(); | |||
while ( it.hasNext() ) | |||
for ( Map.Entry<String, ProjectRepository> entry : mainRepositoriesMap.entrySet() ) | |||
{ | |||
Map.Entry entry = (Entry) it.next(); | |||
String key = (String) entry.getKey(); | |||
ProjectRepository mainProjectRepository = (ProjectRepository) entry.getValue(); | |||
ProjectRepository parentProjectRepository = (ProjectRepository) parentRepositoriesMap.get( key ); | |||
String key = entry.getKey(); | |||
ProjectRepository mainProjectRepository = entry.getValue(); | |||
ProjectRepository parentProjectRepository = parentRepositoriesMap.get( key ); | |||
if ( parentProjectRepository == null ) | |||
{ |
@@ -68,6 +68,7 @@ public class ProjectModelExpressionFilter | |||
* | |||
* @param model the model to correct. | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public ArchivaProjectModel filter( final ArchivaProjectModel model ) | |||
throws ProjectModelException | |||
{ |
@@ -139,6 +139,7 @@ public class ProjectModel300Reader | |||
return getDependencyList( xml, new String[] { "dependencies" } ); | |||
} | |||
@SuppressWarnings("unchecked") | |||
private List<Dependency> getDependencyList( XMLReader xml, String parts[] ) | |||
throws XMLException | |||
{ | |||
@@ -200,6 +201,7 @@ public class ProjectModel300Reader | |||
return individuals; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private List<Individual> getIndividuals( XMLReader xml, boolean isCommitor, String xpathExpr ) | |||
throws XMLException | |||
{ | |||
@@ -270,6 +272,7 @@ public class ProjectModel300Reader | |||
return issueMgmt; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private List<License> getLicenses( XMLReader xml ) | |||
throws XMLException | |||
{ | |||
@@ -297,6 +300,7 @@ public class ProjectModel300Reader | |||
return licenses; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private List<MailingList> getMailingLists( XMLReader xml ) | |||
throws XMLException | |||
{ | |||
@@ -351,6 +355,7 @@ public class ProjectModel300Reader | |||
return null; | |||
} | |||
@SuppressWarnings("unchecked") | |||
private Properties getProperties( Element elemProperties ) | |||
{ | |||
if ( elemProperties == null ) |
@@ -50,6 +50,7 @@ import org.dom4j.Element; | |||
* | |||
* @version $Id$ | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public class ProjectModel400Reader | |||
implements ProjectModelReader | |||
{ |
@@ -37,14 +37,14 @@ import org.apache.maven.archiva.repository.project.ProjectModelResolver; | |||
*/ | |||
public class ProjectModelResolverStack | |||
{ | |||
private List resolvers; | |||
private List<ProjectModelResolver> resolvers; | |||
private List listeners; | |||
private List<ProjectModelResolutionListener> listeners; | |||
public ProjectModelResolverStack() | |||
{ | |||
this.resolvers = new ArrayList(); | |||
this.listeners = new ArrayList(); | |||
this.resolvers = new ArrayList<ProjectModelResolver>(); | |||
this.listeners = new ArrayList<ProjectModelResolutionListener>(); | |||
} | |||
public void addListener( ProjectModelResolutionListener listener ) | |||
@@ -81,11 +81,11 @@ public class ProjectModelResolverStack | |||
triggerResolutionStart( projectRef, this.resolvers ); | |||
Iterator it = this.resolvers.iterator(); | |||
Iterator<ProjectModelResolver> it = this.resolvers.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolver resolver = (ProjectModelResolver) it.next(); | |||
ProjectModelResolver resolver = it.next(); | |||
try | |||
{ | |||
@@ -149,10 +149,10 @@ public class ProjectModelResolverStack | |||
private void triggerResolutionAttempting( VersionedReference projectRef, ProjectModelResolver resolver ) | |||
{ | |||
Iterator it = this.listeners.iterator(); | |||
Iterator<ProjectModelResolutionListener> it = this.listeners.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolutionListener listener = (ProjectModelResolutionListener) it.next(); | |||
ProjectModelResolutionListener listener = it.next(); | |||
try | |||
{ | |||
@@ -167,10 +167,10 @@ public class ProjectModelResolverStack | |||
private void triggerResolutionError( VersionedReference projectRef, ProjectModelResolver resolver, Exception cause ) | |||
{ | |||
Iterator it = this.listeners.iterator(); | |||
Iterator<ProjectModelResolutionListener> it = this.listeners.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolutionListener listener = (ProjectModelResolutionListener) it.next(); | |||
ProjectModelResolutionListener listener = it.next(); | |||
try | |||
{ | |||
@@ -185,10 +185,10 @@ public class ProjectModelResolverStack | |||
private void triggerResolutionMiss( VersionedReference projectRef, ProjectModelResolver resolver ) | |||
{ | |||
Iterator it = this.listeners.iterator(); | |||
Iterator<ProjectModelResolutionListener> it = this.listeners.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolutionListener listener = (ProjectModelResolutionListener) it.next(); | |||
ProjectModelResolutionListener listener = it.next(); | |||
try | |||
{ | |||
@@ -201,12 +201,12 @@ public class ProjectModelResolverStack | |||
} | |||
} | |||
private void triggerResolutionNotFound( VersionedReference projectRef, List resolvers ) | |||
private void triggerResolutionNotFound( VersionedReference projectRef, List<ProjectModelResolver> resolvers ) | |||
{ | |||
Iterator it = this.listeners.iterator(); | |||
Iterator<ProjectModelResolutionListener> it = this.listeners.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolutionListener listener = (ProjectModelResolutionListener) it.next(); | |||
ProjectModelResolutionListener listener = it.next(); | |||
try | |||
{ | |||
@@ -219,12 +219,12 @@ public class ProjectModelResolverStack | |||
} | |||
} | |||
private void triggerResolutionStart( VersionedReference projectRef, List resolvers ) | |||
private void triggerResolutionStart( VersionedReference projectRef, List<ProjectModelResolver> resolvers ) | |||
{ | |||
Iterator it = this.listeners.iterator(); | |||
Iterator<ProjectModelResolutionListener> it = this.listeners.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolutionListener listener = (ProjectModelResolutionListener) it.next(); | |||
ProjectModelResolutionListener listener = it.next(); | |||
try | |||
{ | |||
@@ -240,10 +240,10 @@ public class ProjectModelResolverStack | |||
private void triggerResolutionSuccess( VersionedReference projectRef, ProjectModelResolver resolver, | |||
ArchivaProjectModel model ) | |||
{ | |||
Iterator it = this.listeners.iterator(); | |||
Iterator<ProjectModelResolutionListener> it = this.listeners.iterator(); | |||
while ( it.hasNext() ) | |||
{ | |||
ProjectModelResolutionListener listener = (ProjectModelResolutionListener) it.next(); | |||
ProjectModelResolutionListener listener = it.next(); | |||
try | |||
{ |
@@ -505,6 +505,7 @@ public class ProjectModel400Writer | |||
/** | |||
* Fix the default namespace on all elements recursively. | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
private void fixDefaultNamespace( Element elem ) | |||
{ | |||
elem.remove( elem.getNamespace() ); |
@@ -31,8 +31,6 @@ import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | |||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer; | |||
import org.apache.maven.archiva.repository.RepositoryException; | |||
import org.codehaus.plexus.util.DirectoryWalker; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
/** | |||
* DefaultRepositoryScanner | |||
@@ -43,8 +41,6 @@ import org.slf4j.LoggerFactory; | |||
public class DefaultRepositoryScanner | |||
implements RepositoryScanner | |||
{ | |||
private Logger log = LoggerFactory.getLogger( DefaultRepositoryScanner.class ); | |||
/** | |||
* @plexus.requirement | |||
*/ |
@@ -202,9 +202,10 @@ public class RepositoryContentConsumers | |||
* @return the list of all available {@link KnownRepositoryContentConsumer} present in the classpath and as a | |||
* component in the IoC. | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public List<KnownRepositoryContentConsumer> getAvailableKnownConsumers() | |||
{ | |||
return new ArrayList( applicationContext.getBeansOfType( KnownRepositoryContentConsumer.class ).values() ); | |||
return new ArrayList<KnownRepositoryContentConsumer>( applicationContext.getBeansOfType( KnownRepositoryContentConsumer.class ).values() ); | |||
} | |||
/** | |||
@@ -214,9 +215,10 @@ public class RepositoryContentConsumers | |||
* @return the list of all available {@link InvalidRepositoryContentConsumer} present in the classpath and as a | |||
* component in the IoC. | |||
*/ | |||
@SuppressWarnings("unchecked") | |||
public List<InvalidRepositoryContentConsumer> getAvailableInvalidConsumers() | |||
{ | |||
return new ArrayList( applicationContext.getBeansOfType( InvalidRepositoryContentConsumer.class ).values() ); | |||
return new ArrayList<InvalidRepositoryContentConsumer>( applicationContext.getBeansOfType( InvalidRepositoryContentConsumer.class ).values() ); | |||
} | |||
/** |
@@ -50,7 +50,7 @@ public class ManagedDefaultRepositoryContentTest | |||
public void testGetVersionsBadArtifact() | |||
throws Exception | |||
{ | |||
assertGetVersions( "bad_artifact", Collections.EMPTY_LIST ); | |||
assertGetVersions( "bad_artifact", Collections.<String>emptyList() ); | |||
} | |||
public void testGetVersionsMissingMultipleVersions() |
@@ -378,12 +378,6 @@ public class MetadataToolsTest | |||
assertEquals( "Repository Specific Metadata Path", expected, actual ); | |||
} | |||
private void assertUpdatedProjectMetadata( String artifactId, String[] expectedVersions ) | |||
throws Exception | |||
{ | |||
assertUpdatedProjectMetadata( artifactId, expectedVersions, null, null ); | |||
} | |||
private void assertUpdatedProjectMetadata( String artifactId, String[] expectedVersions, String latestVersion, | |||
String releaseVersion ) | |||
throws Exception |
@@ -54,12 +54,12 @@ public class InvalidScanConsumer | |||
/* do nothing */ | |||
} | |||
public List getExcludes() | |||
public List<String> getExcludes() | |||
{ | |||
return null; | |||
} | |||
public List getIncludes() | |||
public List<String> getIncludes() | |||
{ | |||
return null; | |||
} |
@@ -40,11 +40,11 @@ public class KnownScanConsumer | |||
{ | |||
private int processCount = 0; | |||
private List includes = new ArrayList(); | |||
private List<String> includes = new ArrayList<String>(); | |||
private boolean processUnmodified = false; | |||
public List getExcludes() | |||
public List<String> getExcludes() | |||
{ | |||
return null; | |||
} | |||
@@ -55,7 +55,7 @@ public class KnownScanConsumer | |||
this.includes.addAll( Arrays.asList( includesArray ) ); | |||
} | |||
public List getIncludes() | |||
public List<String> getIncludes() | |||
{ | |||
return includes; | |||
} |
@@ -321,18 +321,19 @@ public class RepositoryContentConsumersTest | |||
return path; | |||
} | |||
private static Map convertToMap(List objects) | |||
@SuppressWarnings("unchecked") | |||
public class MockApplicationContext implements ApplicationContext | |||
{ | |||
HashMap map = new HashMap(); | |||
for (Object o : objects) | |||
private Map convertToMap(List objects) | |||
{ | |||
map.put(o, o); | |||
HashMap map = new HashMap(); | |||
for (Object o : objects) | |||
{ | |||
map.put(o, o); | |||
} | |||
return map; | |||
} | |||
return map; | |||
} | |||
public class MockApplicationContext implements ApplicationContext | |||
{ | |||
private List<KnownRepositoryContentConsumer> knownRepositoryContentConsumer; | |||
private List<InvalidRepositoryContentConsumer> invalidRepositoryContentConsumers; |
@@ -21,6 +21,8 @@ package org.apache.maven.archiva.repository.scanner; | |||
import org.apache.commons.io.FileUtils; | |||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; | |||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer; | |||
import org.apache.maven.archiva.model.RepositoryContentStatistics; | |||
import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; | |||
@@ -109,9 +111,9 @@ public class RepositoryScannerTest | |||
return (RepositoryScanner) lookup( RepositoryScanner.class ); | |||
} | |||
private List getIgnoreList() | |||
private List<String> getIgnoreList() | |||
{ | |||
List ignores = new ArrayList(); | |||
List<String> ignores = new ArrayList<String>(); | |||
ignores.addAll( Arrays.asList( RepositoryScanner.IGNORABLE_CONTENT ) ); | |||
return ignores; | |||
} | |||
@@ -121,12 +123,12 @@ public class RepositoryScannerTest | |||
{ | |||
ManagedRepositoryConfiguration repository = createSimpleRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setIncludes( ARTIFACT_PATTERNS ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -147,12 +149,12 @@ public class RepositoryScannerTest | |||
{ | |||
ManagedRepositoryConfiguration repository = createSimpleRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setIncludes( ARTIFACT_PATTERNS ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -172,13 +174,13 @@ public class RepositoryScannerTest | |||
{ | |||
ManagedRepositoryConfiguration repository = createSimpleRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setProcessUnmodified( true ); | |||
consumer.setIncludes( ARTIFACT_PATTERNS ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -198,13 +200,13 @@ public class RepositoryScannerTest | |||
{ | |||
ManagedRepositoryConfiguration repository = createDefaultRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setIncludes( new String[]{"**/*.jar", "**/*.war", "**/*.pom", "**/maven-metadata.xml", "**/*-site.xml", | |||
"**/*.zip", "**/*.tar.gz", "**/*.sha1", "**/*.md5"} ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -221,7 +223,7 @@ public class RepositoryScannerTest | |||
public void testDefaultRepositoryArtifactScanner() | |||
throws Exception | |||
{ | |||
List actualArtifactPaths = new ArrayList(); | |||
List<String> actualArtifactPaths = new ArrayList<String>(); | |||
actualArtifactPaths.add( "invalid/invalid/1.0-20050611.123456-1/invalid-1.0-20050611.123456-1.jar" ); | |||
actualArtifactPaths.add( "invalid/invalid/1.0-SNAPSHOT/invalid-1.0.jar" ); | |||
@@ -257,12 +259,12 @@ public class RepositoryScannerTest | |||
ManagedRepositoryConfiguration repository = createDefaultRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setIncludes( ARTIFACT_PATTERNS ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -278,7 +280,7 @@ public class RepositoryScannerTest | |||
public void testDefaultRepositoryMetadataScanner() | |||
throws Exception | |||
{ | |||
List actualMetadataPaths = new ArrayList(); | |||
List<String> actualMetadataPaths = new ArrayList<String>(); | |||
actualMetadataPaths.add( "org/apache/maven/some-ejb/1.0/maven-metadata.xml" ); | |||
actualMetadataPaths.add( "org/apache/maven/update/test-not-updated/maven-metadata.xml" ); | |||
@@ -293,12 +295,12 @@ public class RepositoryScannerTest | |||
ManagedRepositoryConfiguration repository = createDefaultRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer knownConsumer = new KnownScanConsumer(); | |||
knownConsumer.setIncludes( new String[]{"**/maven-metadata*.xml"} ); | |||
knownConsumers.add( knownConsumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -314,7 +316,7 @@ public class RepositoryScannerTest | |||
public void testDefaultRepositoryProjectScanner() | |||
throws Exception | |||
{ | |||
List actualProjectPaths = new ArrayList(); | |||
List<String> actualProjectPaths = new ArrayList<String>(); | |||
actualProjectPaths.add( "org/apache/maven/A/1.0/A-1.0.pom" ); | |||
actualProjectPaths.add( "org/apache/maven/B/2.0/B-2.0.pom" ); | |||
@@ -329,12 +331,12 @@ public class RepositoryScannerTest | |||
ManagedRepositoryConfiguration repository = createDefaultRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setIncludes( new String[]{"**/*.pom"} ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -350,7 +352,7 @@ public class RepositoryScannerTest | |||
public void testLegacyRepositoryArtifactScanner() | |||
throws Exception | |||
{ | |||
List actualArtifactPaths = new ArrayList(); | |||
List<String> actualArtifactPaths = new ArrayList<String>(); | |||
actualArtifactPaths.add( "invalid/jars/1.0/invalid-1.0.jar" ); | |||
actualArtifactPaths.add( "invalid/jars/invalid-1.0.rar" ); | |||
@@ -369,12 +371,12 @@ public class RepositoryScannerTest | |||
ManagedRepositoryConfiguration repository = createLegacyRepository(); | |||
List knownConsumers = new ArrayList(); | |||
List<KnownRepositoryContentConsumer> knownConsumers = new ArrayList<KnownRepositoryContentConsumer>(); | |||
KnownScanConsumer consumer = new KnownScanConsumer(); | |||
consumer.setIncludes( ARTIFACT_PATTERNS ); | |||
knownConsumers.add( consumer ); | |||
List invalidConsumers = new ArrayList(); | |||
List<InvalidRepositoryContentConsumer> invalidConsumers = new ArrayList<InvalidRepositoryContentConsumer>(); | |||
InvalidScanConsumer badconsumer = new InvalidScanConsumer(); | |||
invalidConsumers.add( badconsumer ); | |||
@@ -55,12 +55,12 @@ public class SampleKnownConsumer | |||
/* nothing to do */ | |||
} | |||
public List getExcludes() | |||
public List<String> getExcludes() | |||
{ | |||
return null; | |||
} | |||
public List getIncludes() | |||
public List<String> getIncludes() | |||
{ | |||
return null; | |||
} |