import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
-import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.RepositoryContentFactory;
+import org.apache.maven.archiva.repository.RepositoryException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.registry.Registry;
import org.codehaus.plexus.registry.RegistryListener;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
/**
* @plexus.requirement
*/
- private BidirectionalRepositoryLayoutFactory layoutFactory;
+ private RepositoryContentFactory repositoryFactory;
- private List includes = new ArrayList();
+ private List<String> includes = new ArrayList<String>();
public String getId()
{
/* do nothing */
}
- public List getIncludedTypes()
+ public List<String> getIncludedTypes()
{
return null;
}
{
String checksumSha1 = artifact.getModel().getChecksumSHA1();
- List results = null;
+ List<ArchivaArtifact> results = null;
try
{
results = dao.getArtifactDAO().queryArtifacts( new ArtifactsByChecksumConstraint(
return;
}
- Iterator it = results.iterator();
- while ( it.hasNext() )
+ for ( ArchivaArtifact dupArtifact : results )
{
- ArchivaArtifact dupArtifact = (ArchivaArtifact) it.next();
-
if ( dupArtifact.equals( artifact ) )
{
// Skip reference to itself.
{
try
{
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( artifact );
- return layout.toPath( artifact );
+ String repoId = artifact.getModel().getRepositoryId();
+ ManagedRepositoryContent repo = repositoryFactory.getManagedRepositoryContent( repoId );
+ return repo.toPath( artifact );
}
- catch ( LayoutException e )
+ catch ( RepositoryException e )
{
getLogger().warn( "Unable to calculate path for artifact: " + artifact );
return "";
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
-import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
-import org.apache.maven.archiva.repository.layout.LayoutException;
+import org.apache.maven.archiva.repository.ManagedRepositoryContent;
+import org.apache.maven.archiva.repository.RepositoryContentFactory;
+import org.apache.maven.archiva.repository.RepositoryException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
import org.codehaus.plexus.registry.Registry;
/**
* @plexus.requirement
*/
- private BidirectionalRepositoryLayoutFactory layoutFactory;
+ private RepositoryContentFactory repositoryFactory;
private Map repositoryMap = new HashMap();
- private List includes = new ArrayList();
+ private List<String> includes = new ArrayList<String>();
public String getId()
{
return null;
}
- private List findJarEntryPattern( JarFile jar, String pattern )
+ private List<JarEntry> findJarEntryPattern( JarFile jar, String pattern )
{
- List hits = new ArrayList();
+ List<JarEntry> hits = new ArrayList<JarEntry>();
- Enumeration entries = jar.entries();
+ Enumeration<JarEntry> entries = jar.entries();
while ( entries.hasMoreElements() )
{
- JarEntry entry = (JarEntry) entries.nextElement();
+ JarEntry entry = entries.nextElement();
if ( SelectorUtils.match( pattern, entry.getName() ) )
{
hits.add( entry );
{
try
{
- BidirectionalRepositoryLayout layout = layoutFactory.getLayout( artifact );
- return layout.toPath( artifact );
+ String repoId = artifact.getModel().getRepositoryId();
+ ManagedRepositoryContent repo = repositoryFactory.getManagedRepositoryContent( repoId );
+ return repo.toPath( artifact );
}
- catch ( LayoutException e )
+ catch ( RepositoryException e )
{
getLogger().warn( "Unable to calculate path for artifact: " + artifact );
- return null;
+ return "";
}
}