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