mirror of https://github.com/apache/archiva.git
start adding Java5 features to modules
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755239 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
51ad4bdec9
commit
3cdb8ce934
|
@ -47,12 +47,12 @@ public class ArtifactCountConsumer
|
|||
*/
|
||||
private String description;
|
||||
|
||||
private List includes;
|
||||
private List<String> includes;
|
||||
|
||||
public ArtifactCountConsumer()
|
||||
{
|
||||
// TODO: shouldn't this use filetypes?
|
||||
includes = new ArrayList();
|
||||
includes = new ArrayList<String>();
|
||||
includes.add( "**/*.pom" );
|
||||
includes.add( "**/*.jar" );
|
||||
includes.add( "**/*.war" );
|
||||
|
@ -82,12 +82,12 @@ public class ArtifactCountConsumer
|
|||
return false;
|
||||
}
|
||||
|
||||
public List getExcludes()
|
||||
public List<String> getExcludes()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List getIncludes()
|
||||
public List<String> getIncludes()
|
||||
{
|
||||
return includes;
|
||||
}
|
||||
|
|
|
@ -59,13 +59,13 @@ public class ProjectReaderConsumer
|
|||
|
||||
private ManagedRepositoryConfiguration repo;
|
||||
|
||||
private List includes;
|
||||
private List<String> includes;
|
||||
|
||||
public ProjectReaderConsumer()
|
||||
{
|
||||
reader = new ProjectModel400Reader();
|
||||
|
||||
includes = new ArrayList();
|
||||
includes = new ArrayList<String>();
|
||||
includes.add( "**/*.pom" );
|
||||
}
|
||||
|
||||
|
@ -84,12 +84,12 @@ public class ProjectReaderConsumer
|
|||
return false;
|
||||
}
|
||||
|
||||
public List getExcludes()
|
||||
public List<String> getExcludes()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List getIncludes()
|
||||
public List<String> getIncludes()
|
||||
{
|
||||
return includes;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.maven.archiva.converter.artifact;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -48,7 +49,7 @@ public interface ArtifactConverter
|
|||
*
|
||||
* @return the {@link Map}<{@link Artifact}, {@link String}> warning messages.
|
||||
*/
|
||||
Map getWarnings();
|
||||
Map<Artifact, List<String>> getWarnings();
|
||||
|
||||
/**
|
||||
* Clear the list of warning messages.
|
||||
|
|
|
@ -19,6 +19,19 @@ package org.apache.maven.archiva.converter.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.maven.archiva.transaction.FileTransaction;
|
||||
|
@ -45,20 +58,6 @@ import org.codehaus.plexus.digest.Digester;
|
|||
import org.codehaus.plexus.digest.DigesterException;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* LegacyToDefaultConverter
|
||||
*
|
||||
|
@ -75,7 +74,7 @@ public class LegacyToDefaultConverter
|
|||
*
|
||||
* @plexus.requirement role="org.codehaus.plexus.digest.Digester"
|
||||
*/
|
||||
private List digesters;
|
||||
private List<Digester> digesters;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
|
@ -102,7 +101,7 @@ public class LegacyToDefaultConverter
|
|||
*/
|
||||
private boolean dryrun;
|
||||
|
||||
private Map warnings = new HashMap();
|
||||
private Map<Artifact,List<String>> warnings = new HashMap<Artifact,List<String>>();
|
||||
|
||||
public void convert( Artifact artifact, ArtifactRepository targetRepository )
|
||||
throws ArtifactConversionException
|
||||
|
@ -168,6 +167,7 @@ public class LegacyToDefaultConverter
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean copyPom( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
|
||||
throws ArtifactConversionException
|
||||
{
|
||||
|
@ -250,11 +250,10 @@ public class LegacyToDefaultConverter
|
|||
|
||||
transaction.createFile( writer.toString(), targetFile, digesters );
|
||||
|
||||
List warnings = translator.getWarnings();
|
||||
List<String> warnings = translator.getWarnings();
|
||||
|
||||
for ( Iterator i = warnings.iterator(); i.hasNext(); )
|
||||
for ( String message : warnings )
|
||||
{
|
||||
String message = (String) i.next();
|
||||
addWarning( artifact, message );
|
||||
}
|
||||
}
|
||||
|
@ -289,10 +288,8 @@ public class LegacyToDefaultConverter
|
|||
throws IOException
|
||||
{
|
||||
boolean result = true;
|
||||
Iterator it = digesters.iterator();
|
||||
while ( it.hasNext() )
|
||||
for ( Digester digester : digesters )
|
||||
{
|
||||
Digester digester = (Digester) it.next();
|
||||
result &= verifyChecksum( file, file.getName() + "." + getDigesterFileExtension( digester ), digester, //$NON-NLS-1$
|
||||
artifact, "failure.incorrect." + getDigesterFileExtension( digester ) ); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -441,6 +438,7 @@ public class LegacyToDefaultConverter
|
|||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact )
|
||||
{
|
||||
String groupIdKey;
|
||||
|
@ -488,12 +486,12 @@ public class LegacyToDefaultConverter
|
|||
boolean foundVersion = false;
|
||||
if ( metadata.getVersioning() != null )
|
||||
{
|
||||
for ( Iterator i = metadata.getVersioning().getVersions().iterator(); i.hasNext() && !foundVersion; )
|
||||
for ( String version : (List<String>) metadata.getVersioning().getVersions() )
|
||||
{
|
||||
String version = (String) i.next();
|
||||
if ( version.equals( artifact.getBaseVersion() ) )
|
||||
{
|
||||
foundVersion = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -668,10 +666,10 @@ public class LegacyToDefaultConverter
|
|||
|
||||
private void addWarning( Artifact artifact, String message )
|
||||
{
|
||||
List messages = (List) warnings.get( artifact );
|
||||
List<String> messages = warnings.get( artifact );
|
||||
if ( messages == null )
|
||||
{
|
||||
messages = new ArrayList();
|
||||
messages = new ArrayList<String>();
|
||||
}
|
||||
messages.add( message );
|
||||
warnings.put( artifact, messages );
|
||||
|
@ -682,7 +680,7 @@ public class LegacyToDefaultConverter
|
|||
warnings.clear();
|
||||
}
|
||||
|
||||
public Map getWarnings()
|
||||
public Map<Artifact, List<String>> getWarnings()
|
||||
{
|
||||
return warnings;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,15 @@ package org.apache.maven.archiva.converter.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
|
@ -30,17 +39,6 @@ import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
|
|||
import org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata;
|
||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
/**
|
||||
* LegacyToDefaultConverterTest
|
||||
*
|
||||
|
@ -736,19 +734,21 @@ public class LegacyToDefaultConverterTest
|
|||
|
||||
boolean found = false;
|
||||
String pattern = "^" + Messages.getString( "invalid.source.pom" ).replaceFirst( "\\{0\\}", ".*" ) + "$";
|
||||
for ( Iterator it = artifactConverter.getWarnings().values().iterator(); it.hasNext() && !found; )
|
||||
for ( List<String> messages : artifactConverter.getWarnings().values() )
|
||||
{
|
||||
List messages = (List) it.next();
|
||||
|
||||
for ( Iterator itmsgs = messages.iterator(); itmsgs.hasNext(); )
|
||||
for ( String message : messages )
|
||||
{
|
||||
String message = (String) itmsgs.next();
|
||||
if ( message.matches( pattern ) )
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( found )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue( "Check failure message.", found );
|
||||
|
@ -763,22 +763,19 @@ public class LegacyToDefaultConverterTest
|
|||
{
|
||||
// test multiple artifacts are converted
|
||||
|
||||
List artifacts = new ArrayList();
|
||||
List<Artifact> artifacts = new ArrayList<Artifact>();
|
||||
artifacts.add( createArtifact( "test", "artifact-one", "1.0.0" ) );
|
||||
artifacts.add( createArtifact( "test", "artifact-two", "1.0.0" ) );
|
||||
artifacts.add( createArtifact( "test", "artifact-three", "1.0.0" ) );
|
||||
|
||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
||||
for ( Artifact artifact : artifacts )
|
||||
{
|
||||
Artifact arti = (Artifact) it.next();
|
||||
artifactConverter.convert( arti, targetRepository );
|
||||
artifactConverter.convert( artifact, targetRepository );
|
||||
checkSuccess( artifactConverter );
|
||||
}
|
||||
|
||||
for ( Iterator i = artifacts.iterator(); i.hasNext(); )
|
||||
for ( Artifact artifact : artifacts )
|
||||
{
|
||||
Artifact artifact = (Artifact) i.next();
|
||||
|
||||
File artifactFile = new File( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
|
||||
assertTrue( "Check artifact created", artifactFile.exists() );
|
||||
assertTrue( "Check artifact matches", FileUtils.contentEquals( artifactFile, artifact.getFile() ) );
|
||||
|
@ -954,9 +951,8 @@ public class LegacyToDefaultConverterTest
|
|||
private int countWarningMessages( ArtifactConverter converter )
|
||||
{
|
||||
int count = 0;
|
||||
for ( Iterator it = converter.getWarnings().values().iterator(); it.hasNext(); )
|
||||
for ( List<String> values : converter.getWarnings().values() )
|
||||
{
|
||||
List values = (List) it.next();
|
||||
count += values.size();
|
||||
}
|
||||
return count;
|
||||
|
@ -967,28 +963,25 @@ public class LegacyToDefaultConverterTest
|
|||
assertNotNull( "Warnings should never be null.", converter.getWarnings() );
|
||||
assertTrue( "Expecting 1 or more Warnings", countWarningMessages( converter ) > 0 );
|
||||
|
||||
for ( Iterator it = converter.getWarnings().values().iterator(); it.hasNext(); )
|
||||
for ( List<String> messages : converter.getWarnings().values() )
|
||||
{
|
||||
List messages = (List) it.next();
|
||||
if ( messages.contains( reason ) )
|
||||
{
|
||||
/* No need to check any furthor */
|
||||
/* No need to check any further */
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* didn't find it. */
|
||||
|
||||
for ( Iterator it = converter.getWarnings().entrySet().iterator(); it.hasNext(); )
|
||||
for ( Map.Entry<Artifact,List<String>> entry : converter.getWarnings().entrySet() )
|
||||
{
|
||||
Map.Entry entry = (Entry) it.next();
|
||||
Artifact artifact = (Artifact) entry.getKey();
|
||||
System.out.println( "-Artifact: " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":"
|
||||
+ artifact.getVersion() );
|
||||
List messages = (List) entry.getValue();
|
||||
for ( Iterator itmsgs = messages.iterator(); itmsgs.hasNext(); )
|
||||
List<String> messages = entry.getValue();
|
||||
for ( String message : messages )
|
||||
{
|
||||
String message = (String) itmsgs.next();
|
||||
System.out.println( " " + message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public interface ArtifactDAO
|
|||
String type, String repositoryId )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException;
|
||||
|
||||
public List /*<ArchivaArtifact>*/queryArtifacts( Constraint constraint )
|
||||
public List<ArchivaArtifact> queryArtifacts( Constraint constraint )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException;
|
||||
|
||||
public ArchivaArtifact saveArtifact( ArchivaArtifact artifact )
|
||||
|
|
|
@ -51,7 +51,7 @@ public interface RepositoryProblemDAO
|
|||
* This is the only list of options created in this DAO.
|
||||
*/
|
||||
|
||||
public List /*<RepositoryProblem>*/queryRepositoryProblems( Constraint constraint )
|
||||
public List <RepositoryProblem> queryRepositoryProblems( Constraint constraint )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException;
|
||||
|
||||
public RepositoryProblem saveRepositoryProblem( RepositoryProblem problem )
|
||||
|
|
|
@ -19,6 +19,16 @@ package org.apache.maven.archiva.database;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jdo.PersistenceManager;
|
||||
import javax.jdo.PersistenceManagerFactory;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.maven.archiva.database.updater.DatabaseCleanupConsumer;
|
||||
import org.apache.maven.archiva.database.updater.DatabaseUnprocessedArtifactConsumer;
|
||||
|
@ -31,17 +41,6 @@ import org.codehaus.plexus.jdo.JdoFactory;
|
|||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
import org.jpox.SchemaTool;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jdo.PersistenceManager;
|
||||
import javax.jdo.PersistenceManagerFactory;
|
||||
|
||||
/**
|
||||
* AbstractArchivaDatabaseTestCase
|
||||
*
|
||||
|
@ -103,10 +102,8 @@ public abstract class AbstractArchivaDatabaseTestCase
|
|||
|
||||
Properties properties = jdoFactory.getProperties();
|
||||
|
||||
for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); )
|
||||
for ( Map.Entry<Object,Object> entry : properties.entrySet() )
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
|
||||
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public class TestDatabaseCleanupConsumer
|
|||
countComplete++;
|
||||
}
|
||||
|
||||
public List getIncludedTypes()
|
||||
public List<String> getIncludedTypes()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ public class TestDatabaseUnprocessedConsumer
|
|||
countComplete++;
|
||||
}
|
||||
|
||||
public List getIncludedTypes()
|
||||
public List<String> getIncludedTypes()
|
||||
{
|
||||
List types = new ArrayList();
|
||||
List<String> types = new ArrayList<String>();
|
||||
types.add( "pom" );
|
||||
types.add( "jar" );
|
||||
return types;
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.archiva.reporting.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.archiva.model.RepositoryProblem;
|
||||
import org.apache.maven.archiva.reporting.DynamicReportSource;
|
||||
import org.apache.maven.archiva.reporting.DataLimits;
|
||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||
|
@ -56,13 +57,13 @@ public class CorruptArtifactReport
|
|||
constraint = new RepositoryProblemByTypeConstraint( PROBLEM_TYPE_CORRUPT_ARTIFACT );
|
||||
}
|
||||
|
||||
public List getData()
|
||||
public List<RepositoryProblem> getData()
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
|
||||
}
|
||||
|
||||
public List getData( DataLimits limits )
|
||||
public List<RepositoryProblem> getData( DataLimits limits )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
|||
import org.apache.maven.archiva.database.Constraint;
|
||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||
import org.apache.maven.archiva.database.constraints.RepositoryProblemByTypeConstraint;
|
||||
import org.apache.maven.archiva.model.RepositoryProblem;
|
||||
import org.apache.maven.archiva.reporting.DataLimits;
|
||||
import org.apache.maven.archiva.reporting.DynamicReportSource;
|
||||
|
||||
|
@ -59,13 +60,13 @@ public class DuplicateArtifactReport
|
|||
constraint = new RepositoryProblemByTypeConstraint( PROBLEM_TYPE_DUPLICATE_ARTIFACTS );
|
||||
}
|
||||
|
||||
public List getData()
|
||||
public List<RepositoryProblem> getData()
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
|
||||
}
|
||||
|
||||
public List getData( DataLimits limits )
|
||||
public List<RepositoryProblem> getData( DataLimits limits )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
// TODO: implement limits.
|
||||
|
|
|
@ -98,7 +98,8 @@ public class LocationArtifactsConsumer
|
|||
*/
|
||||
private RepositoryContentFactory repositoryFactory;
|
||||
|
||||
private Map repositoryMap = new HashMap();
|
||||
private Map<String, ManagedRepositoryConfiguration> repositoryMap =
|
||||
new HashMap<String, ManagedRepositoryConfiguration>();
|
||||
|
||||
// TODO: why is this not used? If it should be, what about excludes?
|
||||
private List<String> includes = new ArrayList<String>();
|
||||
|
@ -128,7 +129,7 @@ public class LocationArtifactsConsumer
|
|||
/* do nothing */
|
||||
}
|
||||
|
||||
public List getIncludedTypes()
|
||||
public List<String> getIncludedTypes()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -203,7 +204,7 @@ public class LocationArtifactsConsumer
|
|||
* indicate that the artifact is, indeed located in the wrong place.
|
||||
*/
|
||||
|
||||
List actualPomXmls = findJarEntryPattern( jar, "META-INF/maven/**/pom.xml" );
|
||||
List<JarEntry> actualPomXmls = findJarEntryPattern( jar, "META-INF/maven/**/pom.xml" );
|
||||
if ( actualPomXmls.isEmpty() )
|
||||
{
|
||||
// No check needed.
|
||||
|
@ -267,27 +268,27 @@ public class LocationArtifactsConsumer
|
|||
|
||||
private ArchivaProjectModel readFilesystemModel( File artifactFile )
|
||||
{
|
||||
File pomFile = createPomFileReference( artifactFile );
|
||||
// File pomFile = createPomFileReference( artifactFile );
|
||||
|
||||
// TODO: read and resolve model here.
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private File createPomFileReference( File artifactFile )
|
||||
{
|
||||
String pomFilename = artifactFile.getAbsolutePath();
|
||||
|
||||
int pos = pomFilename.lastIndexOf( '.' );
|
||||
if ( pos <= 0 )
|
||||
{
|
||||
// Invalid filename.
|
||||
return null;
|
||||
}
|
||||
|
||||
pomFilename = pomFilename.substring( 0, pos ) + ".pom";
|
||||
return new File( pomFilename );
|
||||
}
|
||||
// private File createPomFileReference( File artifactFile )
|
||||
// {
|
||||
// String pomFilename = artifactFile.getAbsolutePath();
|
||||
//
|
||||
// int pos = pomFilename.lastIndexOf( '.' );
|
||||
// if ( pos <= 0 )
|
||||
// {
|
||||
// // Invalid filename.
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// pomFilename = pomFilename.substring( 0, pos ) + ".pom";
|
||||
// return new File( pomFilename );
|
||||
// }
|
||||
|
||||
private ManagedRepositoryConfiguration findRepository( ArchivaArtifact artifact )
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
|||
import org.apache.maven.archiva.database.Constraint;
|
||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||
import org.apache.maven.archiva.database.constraints.RepositoryProblemByTypeConstraint;
|
||||
import org.apache.maven.archiva.model.RepositoryProblem;
|
||||
import org.apache.maven.archiva.reporting.DataLimits;
|
||||
import org.apache.maven.archiva.reporting.DynamicReportSource;
|
||||
|
||||
|
@ -59,13 +60,13 @@ public class LocationArtifactsReport
|
|||
constraint = new RepositoryProblemByTypeConstraint( PROBLEM_TYPE_BAD_ARTIFACT_LOCATION );
|
||||
}
|
||||
|
||||
public List getData()
|
||||
public List<RepositoryProblem> getData()
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
|
||||
}
|
||||
|
||||
public List getData( DataLimits limits )
|
||||
public List<RepositoryProblem> getData( DataLimits limits )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
// TODO: implement limits.
|
||||
|
|
|
@ -19,15 +19,16 @@ package org.apache.maven.archiva.reporting.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||
import org.apache.maven.archiva.database.constraints.OlderArtifactsByAgeConstraint;
|
||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||
import org.apache.maven.archiva.reporting.DataLimits;
|
||||
import org.apache.maven.archiva.reporting.DynamicReportSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OldArtifactReport
|
||||
*
|
||||
|
@ -56,13 +57,13 @@ public class OldArtifactReport
|
|||
*/
|
||||
private int cutoffDays;
|
||||
|
||||
public List getData()
|
||||
public List<ArchivaArtifact> getData()
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getArtifactDAO().queryArtifacts( new OlderArtifactsByAgeConstraint( cutoffDays ) );
|
||||
}
|
||||
|
||||
public List getData( DataLimits limits )
|
||||
public List<ArchivaArtifact> getData( DataLimits limits )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getArtifactDAO().queryArtifacts( new OlderArtifactsByAgeConstraint( cutoffDays ) );
|
||||
|
|
|
@ -19,15 +19,16 @@ package org.apache.maven.archiva.reporting.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||
import org.apache.maven.archiva.database.constraints.OlderSnapshotArtifactsByAgeConstraint;
|
||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||
import org.apache.maven.archiva.reporting.DataLimits;
|
||||
import org.apache.maven.archiva.reporting.DynamicReportSource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OldSnapshotArtifactReport
|
||||
*
|
||||
|
@ -56,13 +57,13 @@ public class OldSnapshotArtifactReport
|
|||
*/
|
||||
private int cutoffDays;
|
||||
|
||||
public List getData()
|
||||
public List<ArchivaArtifact> getData()
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getArtifactDAO().queryArtifacts( new OlderSnapshotArtifactsByAgeConstraint( cutoffDays ) );
|
||||
}
|
||||
|
||||
public List getData( DataLimits limits )
|
||||
public List<ArchivaArtifact> getData( DataLimits limits )
|
||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||
{
|
||||
return dao.getArtifactDAO().queryArtifacts( new OlderSnapshotArtifactsByAgeConstraint( cutoffDays ) );
|
||||
|
|
|
@ -19,21 +19,20 @@ package org.apache.maven.archiva.reporting.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.jdo.PersistenceManager;
|
||||
import javax.jdo.PersistenceManagerFactory;
|
||||
|
||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||
import org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory;
|
||||
import org.codehaus.plexus.jdo.JdoFactory;
|
||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
||||
import org.jpox.SchemaTool;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.jdo.PersistenceManager;
|
||||
import javax.jdo.PersistenceManagerFactory;
|
||||
|
||||
/**
|
||||
* AbstractArtifactReportsTestCase
|
||||
*
|
||||
|
@ -92,10 +91,8 @@ public abstract class AbstractArtifactReportsTestCase
|
|||
|
||||
Properties properties = jdoFactory.getProperties();
|
||||
|
||||
for ( Iterator it = properties.entrySet().iterator(); it.hasNext(); )
|
||||
for ( Entry<Object, Object> entry : properties.entrySet() )
|
||||
{
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
|
||||
System.setProperty( (String) entry.getKey(), (String) entry.getValue() );
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@ package org.apache.maven.archiva.reporting.artifact;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
|
@ -28,11 +32,6 @@ import org.apache.maven.archiva.model.ArchivaArtifact;
|
|||
import org.apache.maven.archiva.model.RepositoryProblem;
|
||||
import org.apache.maven.archiva.reporting.DynamicReportSource;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DuplicateArtifactReportTest
|
||||
*
|
||||
|
@ -115,20 +114,18 @@ public class DuplicateArtifactReportTest
|
|||
// Setup entries for bad/duplicate in problem DB.
|
||||
pretendToRunDuplicateArtifactsConsumer();
|
||||
|
||||
List allArtifacts = artifactDao.queryArtifacts( null );
|
||||
List<ArchivaArtifact> allArtifacts = artifactDao.queryArtifacts( null );
|
||||
assertEquals( "Total Artifact Count", 7, allArtifacts.size() );
|
||||
|
||||
DuplicateArtifactReport report =
|
||||
(DuplicateArtifactReport) lookup( DynamicReportSource.class.getName(), "duplicate-artifacts" );
|
||||
|
||||
List results = report.getData();
|
||||
List<RepositoryProblem> results = report.getData();
|
||||
|
||||
System.out.println( "Results.size: " + results.size() );
|
||||
int i = 0;
|
||||
Iterator it = results.iterator();
|
||||
while ( it.hasNext() )
|
||||
for ( RepositoryProblem problem : results )
|
||||
{
|
||||
RepositoryProblem problem = (RepositoryProblem) it.next();
|
||||
System.out.println( "[" + ( i++ ) + "] " + problem.getMessage() );
|
||||
}
|
||||
|
||||
|
@ -144,16 +141,14 @@ public class DuplicateArtifactReportTest
|
|||
private void pretendToRunDuplicateArtifactsConsumer()
|
||||
throws Exception
|
||||
{
|
||||
List artifacts = dao.getArtifactDAO().queryArtifacts( null );
|
||||
List<ArchivaArtifact> artifacts = dao.getArtifactDAO().queryArtifacts( null );
|
||||
ArchivaArtifactConsumer consumer =
|
||||
(ArchivaArtifactConsumer) lookup( ArchivaArtifactConsumer.class.getName(), "duplicate-artifacts" );
|
||||
consumer.beginScan();
|
||||
try
|
||||
{
|
||||
Iterator it = artifacts.iterator();
|
||||
while ( it.hasNext() )
|
||||
for ( ArchivaArtifact artifact : artifacts )
|
||||
{
|
||||
ArchivaArtifact artifact = (ArchivaArtifact) it.next();
|
||||
consumer.processArchivaArtifact( artifact );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,9 +19,8 @@ package org.apache.maven.archiva.applet;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import java.applet.Applet;
|
||||
import java.awt.*;
|
||||
import java.awt.BorderLayout;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -32,6 +31,9 @@ import java.security.MessageDigest;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JProgressBar;
|
||||
|
||||
/**
|
||||
* Applet that takes a file on the local filesystem and checksums it for sending to the server.
|
||||
*
|
||||
|
@ -58,9 +60,9 @@ public class ChecksumApplet
|
|||
public String generateMd5( final String file )
|
||||
throws IOException, NoSuchAlgorithmException
|
||||
{
|
||||
Object o = AccessController.doPrivileged( new PrivilegedAction()
|
||||
return AccessController.doPrivileged( new PrivilegedAction<String>()
|
||||
{
|
||||
public Object run()
|
||||
public String run()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -80,7 +82,6 @@ public class ChecksumApplet
|
|||
}
|
||||
}
|
||||
} );
|
||||
return (String) o;
|
||||
}
|
||||
|
||||
protected String checksumFile( String file )
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
|||
import org.apache.maven.archiva.configuration.ConfigurationNames;
|
||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||
import org.apache.maven.archiva.security.ArchivaRoleConstants;
|
||||
import org.apache.maven.archiva.security.ArchivaXworkUser;
|
||||
import org.codehaus.plexus.redback.rbac.RBACManager;
|
||||
import org.codehaus.plexus.redback.rbac.RbacManagerException;
|
||||
import org.codehaus.plexus.redback.rbac.UserAssignment;
|
||||
|
@ -75,11 +74,6 @@ public class SecuritySynchronization
|
|||
*/
|
||||
private ArchivaConfiguration archivaConfiguration;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
private ArchivaXworkUser archivaXworkUser;
|
||||
|
||||
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
||||
{
|
||||
if ( ConfigurationNames.isManagedRepositories( propertyName ) )
|
||||
|
|
Loading…
Reference in New Issue