Cleanup of API and dependencies

This commit is contained in:
Martin Stockhammer 2020-06-16 19:33:30 +02:00
parent bb0bc93d80
commit add9451d9e
33 changed files with 99 additions and 323 deletions

View File

@ -19,25 +19,23 @@ package $package;
* under the License.
*/
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContentFactory;
import org.apache.archiva.repository.content.Artifact;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;

View File

@ -21,27 +21,26 @@ package org.apache.archiva.consumers.core.repository;
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.repository.ContentNotFoundException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ContentNotFoundException;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ItemNotFoundException;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.Project;
import org.apache.archiva.repository.content.Version;
import org.apache.archiva.repository.content.base.ArchivaItemSelector;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.storage.StorageAsset;
import java.io.IOException;

View File

@ -23,7 +23,6 @@ import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
@ -133,19 +132,4 @@ public class RetentionCountRepositoryPurge
}
}
/*
* Returns a new artifact reference with different version
*/
private ArtifactReference getNewArtifactReference( ArtifactReference reference, String version )
throws LayoutException
{
ArtifactReference artifact = new ArtifactReference( );
artifact.setGroupId( reference.getGroupId( ) );
artifact.setArtifactId( reference.getArtifactId( ) );
artifact.setVersion( version );
artifact.setClassifier( reference.getClassifier( ) );
artifact.setType( reference.getType( ) );
return artifact;
}
}

View File

@ -45,10 +45,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-policies</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -19,7 +19,6 @@ package org.apache.archiva.proxy.model;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.Policy;
import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.repository.ManagedRepository;

View File

@ -81,10 +81,6 @@
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-model</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-checksum</artifactId>

View File

@ -23,11 +23,10 @@ import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.checksum.ChecksumUtil;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.ProxyConnectorRuleConfiguration;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.Keys;
import org.apache.archiva.policies.DownloadErrorPolicy;
import org.apache.archiva.policies.DownloadPolicy;
import org.apache.archiva.policies.Policy;
@ -42,9 +41,6 @@ import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.proxy.model.ProxyConnector;
import org.apache.archiva.proxy.model.ProxyFetchResult;
import org.apache.archiva.proxy.model.RepositoryProxyHandler;
import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RemoteRepositoryContent;
@ -52,12 +48,11 @@ import org.apache.archiva.repository.RepositoryType;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ContentItem;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.base.ArchivaItemSelector;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import org.apache.archiva.repository.storage.fs.FsStorageUtil;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.apache.commons.collections4.CollectionUtils;
@ -470,19 +465,6 @@ public abstract class DefaultRepositoryProxyHandler implements RepositoryProxyHa
}
}
private StorageAsset toLocalFile(ManagedRepository repository, ArtifactReference artifact ) throws LayoutException
{
ItemSelector selector = ArchivaItemSelector.builder( )
.withNamespace( artifact.getGroupId( ) )
.withProjectId( artifact.getArtifactId( ) )
.withArtifactId( artifact.getArtifactId( ) )
.withArtifactVersion( artifact.getVersion() )
.withVersion( artifact.getProjectVersion( ) )
.withType( artifact.getType( ) ).build();
Artifact repoArtifact = repository.getContent( ).getLayout( BaseRepositoryContentLayout.class ).getArtifact( selector );
return repoArtifact.getAsset( );
}
/**
* Simple method to test if the file exists on the local disk.
*
@ -775,59 +757,6 @@ public abstract class DefaultRepositoryProxyHandler implements RepositoryProxyHa
log.debug( "Full stack trace", exception );
}
private void validatePolicies( Map<String, DownloadErrorPolicy> policies, Map<Policy, PolicyOption> settings,
Properties request, ArtifactReference artifact, RemoteRepositoryContent content,
StorageAsset localFile, Exception exception, Map<String, Exception> previousExceptions )
throws ProxyDownloadException
{
boolean process = true;
for ( Map.Entry<String, ? extends DownloadErrorPolicy> entry : policies.entrySet() )
{
// olamy with spring rolehint is now downloadPolicy#hint
// so substring after last # to get the hint as with plexus
String key = entry.getValue( ).getId( );
DownloadErrorPolicy policy = entry.getValue();
PolicyOption option = settings.containsKey( policy ) ? settings.get(policy) : policy.getDefaultOption();
log.debug( "Applying [{}] policy with [{}]", key, option );
try
{
// all policies must approve the exception, any can cancel
process = policy.applyPolicy( option, request, localFile, exception, previousExceptions );
if ( !process )
{
break;
}
}
catch ( PolicyConfigurationException e )
{
log.error( e.getMessage(), e );
}
}
if ( process )
{
// if the exception was queued, don't throw it
if ( !previousExceptions.containsKey( content.getId() ) )
{
throw new ProxyDownloadException(
"An error occurred in downloading from the remote repository, and the policy is to fail immediately",
content.getId(), exception );
}
}
else
{
// if the exception was queued, but cancelled, remove it
previousExceptions.remove( content.getId() );
}
log.warn(
"Transfer error from repository {} for artifact {} , continuing to next repository. Error message: {}",
content.getRepository().getId(), Keys.toKey( artifact ), exception.getMessage() );
log.debug( "Full stack trace", exception );
}
/**
* Creates a working directory
*

View File

@ -19,10 +19,6 @@ package org.apache.archiva.repository;
* under the License.
*/
import org.apache.archiva.model.ArchivaArtifact;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ContentItem;
import org.apache.archiva.repository.content.DataItem;

View File

@ -19,9 +19,6 @@ package org.apache.archiva.repository;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.RepositoryURL;
/**
* RemoteRepositoryContent interface for interacting with a remote repository in an abstract way,
* without the need for processing based on URLs, or working with the database.

View File

@ -19,7 +19,6 @@ package org.apache.archiva.repository;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.content.ItemSelector;

View File

@ -19,7 +19,6 @@ package org.apache.archiva.repository;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.features.RepositoryFeature;

View File

@ -19,8 +19,6 @@ package org.apache.archiva.repository.content;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
/**
* Represents a artifact of a repository. This object contains unique coordinates of the
* artifact. A artifact has exactly one file representation in the repository.

View File

@ -73,18 +73,7 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>metadata-model</artifactId>
</dependency>
-->
<dependency>
<groupId>org.apache.archiva.components.registry</groupId>
<artifactId>archiva-components-spring-registry-api</artifactId>
@ -117,25 +106,16 @@
<!-- Test scope -->
<!--
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-test-utils</artifactId>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
@ -146,11 +126,7 @@
<artifactId>log4j-jcl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.archiva.components.cache</groupId>
<artifactId>archiva-components-spring-cache-ehcache</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>

View File

@ -23,25 +23,23 @@ import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.checksum.ChecksummedFile;
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ConfigurationEvent;
import org.apache.archiva.configuration.ConfigurationListener;
import org.apache.archiva.configuration.ConfigurationNames;
import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
// import org.apache.archiva.maven2.metadata.MavenMetadataReader;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.Plugin;
import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.SnapshotVersion;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.components.registry.Registry;
import org.apache.archiva.components.registry.RegistryListener;
import org.apache.archiva.repository.ContentNotFoundException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ContentNotFoundException;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RemoteRepositoryContent;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.RepositoryType;
@ -63,15 +61,28 @@ import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import java.util.stream.Stream;
// import org.apache.archiva.maven2.metadata.MavenMetadataReader;
/**
* MetadataTools
*

View File

@ -21,10 +21,15 @@ package org.apache.archiva.repository.scanner.mock;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.*;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ContentAccessException;
import org.apache.archiva.repository.ItemDeleteStatus;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.ManagedRepositoryContentLayout;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.BaseDataItemTypes;
import org.apache.archiva.repository.content.ContentItem;
@ -38,15 +43,13 @@ import org.apache.archiva.repository.content.base.ArchivaDataItem;
import org.apache.archiva.repository.content.base.ArchivaNamespace;
import org.apache.archiva.repository.content.base.ArchivaProject;
import org.apache.archiva.repository.content.base.ArchivaVersion;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -339,8 +342,6 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
this.repository = repo;
}
private Map<ArtifactReference, String> refs = new HashMap<>();
public ArtifactMetadata getArtifactForPath( String repoId, String relativePath )
{
String[] parts = relativePath.replace( '\\', '/' ).split( "/" );

View File

@ -20,7 +20,6 @@ package org.apache.archiva.proxy;
*/
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.ReleasesPolicy;

View File

@ -20,7 +20,6 @@ package org.apache.archiva.proxy;
*/
import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.ReleasesPolicy;

View File

@ -23,7 +23,6 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.NetworkProxyConfiguration;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
@ -31,7 +30,10 @@ import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
import org.apache.archiva.policies.ReleasesPolicy;
import org.apache.archiva.policies.SnapshotsPolicy;
import org.apache.archiva.proxy.model.RepositoryProxyHandler;
import org.apache.archiva.repository.*;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.base.BasicManagedRepository;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.storage.StorageAsset;

View File

@ -19,7 +19,6 @@ package org.apache.archiva.proxy;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.ReleasesPolicy;

View File

@ -19,7 +19,6 @@ package org.apache.archiva.proxy;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.CachedFailuresPolicy;
import org.apache.archiva.policies.ChecksumPolicy;
import org.apache.archiva.policies.ReleasesPolicy;

View File

@ -21,10 +21,15 @@ package org.apache.archiva.repository.mock;
import org.apache.archiva.common.filelock.DefaultFileLockManager;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.*;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ContentAccessException;
import org.apache.archiva.repository.ItemDeleteStatus;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.ManagedRepositoryContentLayout;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.BaseDataItemTypes;
import org.apache.archiva.repository.content.ContentItem;
@ -40,17 +45,15 @@ import org.apache.archiva.repository.content.base.ArchivaDataItem;
import org.apache.archiva.repository.content.base.ArchivaNamespace;
import org.apache.archiva.repository.content.base.ArchivaProject;
import org.apache.archiva.repository.content.base.ArchivaVersion;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import org.apache.archiva.repository.storage.RepositoryStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -372,8 +375,6 @@ public class ManagedRepositoryContentMock implements BaseRepositoryContentLayout
this.repository = repo;
}
private Map<ArtifactReference, String> refs = new HashMap<>();
public ArtifactMetadata getArtifactForPath( String repoId, String relativePath )
{
String[] parts = relativePath.replace( '\\', '/' ).split( "/" );

View File

@ -23,7 +23,6 @@ import org.apache.archiva.common.utils.FileUtils;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.metadata.maven.MavenMetadataReader;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ContentAccessException;
import org.apache.archiva.repository.EditableManagedRepository;
@ -57,10 +56,8 @@ import org.apache.commons.lang3.StringUtils;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -1549,75 +1546,6 @@ public class ManagedDefaultRepositoryContent
return repository.getId( );
}
/*
* Create the filter for various combinations of classifier and type
*/
private Predicate<ArtifactReference> getChecker( ArtifactReference referenceObject, String extension )
{
// TODO: Check, if extension is the correct parameter here
// We compare type with extension which works for artifacts like .jar.md5 but may
// be not the best way.
if ( referenceObject.getClassifier( ) != null && referenceObject.getType( ) != null )
{
return ( ( ArtifactReference a ) ->
referenceObject.getGroupId( ).equals( a.getGroupId( ) )
&& referenceObject.getArtifactId( ).equals( a.getArtifactId( ) )
&& referenceObject.getVersion( ).equals( a.getVersion( ) )
&& ( ( a.getType( ) == null )
|| referenceObject.getType( ).equals( a.getType( ) )
|| a.getType( ).startsWith( extension ) )
&& referenceObject.getClassifier( ).equals( a.getClassifier( ) )
);
}
else if ( referenceObject.getClassifier( ) != null && referenceObject.getType( ) == null )
{
return ( ( ArtifactReference a ) ->
referenceObject.getGroupId( ).equals( a.getGroupId( ) )
&& referenceObject.getArtifactId( ).equals( a.getArtifactId( ) )
&& referenceObject.getVersion( ).equals( a.getVersion( ) )
&& referenceObject.getClassifier( ).equals( a.getClassifier( ) )
);
}
else if ( referenceObject.getClassifier( ) == null && referenceObject.getType( ) != null )
{
return ( ( ArtifactReference a ) ->
referenceObject.getGroupId( ).equals( a.getGroupId( ) )
&& referenceObject.getArtifactId( ).equals( a.getArtifactId( ) )
&& referenceObject.getVersion( ).equals( a.getVersion( ) )
&& ( ( a.getType( ) == null )
|| referenceObject.getType( ).equals( a.getType( ) )
|| a.getType( ).startsWith( extension ) )
);
}
else
{
return ( ( ArtifactReference a ) ->
referenceObject.getGroupId( ).equals( a.getGroupId( ) )
&& referenceObject.getArtifactId( ).equals( a.getArtifactId( ) )
&& referenceObject.getVersion( ).equals( a.getVersion( ) )
);
}
}
private String convertUriToPath( URI uri )
{
if ( uri.getScheme( ) == null )
{
return Paths.get( uri.getPath( ) ).toString( );
}
else if ( "file".equals( uri.getScheme( ) ) )
{
return Paths.get( uri ).toString( );
}
else
{
return uri.toString( );
}
}
@Override
public ManagedRepository getRepository( )
{

View File

@ -18,19 +18,17 @@ package org.apache.archiva.repository.maven.content;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContent;
import org.apache.archiva.repository.content.base.ArchivaArtifact;
import org.apache.archiva.repository.maven.AbstractRepositoryLayerTestCase;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.Namespace;
import org.apache.archiva.repository.content.Project;
import org.apache.archiva.repository.content.Version;
import org.apache.archiva.repository.content.base.ArchivaItemSelector;
import org.apache.archiva.repository.maven.AbstractRepositoryLayerTestCase;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

View File

@ -25,14 +25,11 @@ import org.apache.archiva.configuration.FileType;
import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.metadata.maven.MavenMetadataReader;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.ProjectReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.EditableManagedRepository;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContent;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.BaseArtifactTypes;

View File

@ -24,13 +24,12 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.FileType;
import org.apache.archiva.configuration.FileTypes;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.maven.metadata.storage.ArtifactMappingProvider;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContentProvider;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.maven.MavenManagedRepository;
import org.apache.archiva.repository.maven.metadata.storage.ArtifactMappingProvider;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.commons.lang3.StringUtils;
import org.junit.Before;

View File

@ -19,12 +19,9 @@ package org.apache.archiva.repository.maven.content;
*/
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RemoteRepositoryContent;
import org.apache.archiva.repository.RepositoryContent;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ItemSelector;

View File

@ -19,7 +19,6 @@ package org.apache.archiva.scheduler.repository;
* under the License.
*/
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;

View File

@ -22,7 +22,6 @@ package org.apache.archiva.scheduler.repository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.stats.model.DefaultRepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.apache.commons.io.FileUtils;
import org.junit.Test;

View File

@ -22,11 +22,9 @@ package org.apache.archiva.scheduler.repository;
import org.apache.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.archiva.consumers.ConsumerException;
import org.apache.archiva.consumers.KnownRepositoryContentConsumer;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContentFactory;
import org.springframework.stereotype.Service;

View File

@ -25,29 +25,33 @@ import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.checksum.ChecksummedFile;
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.common.utils.VersionUtil;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
import org.apache.archiva.metadata.repository.*;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.AuthorizationException;
import org.apache.archiva.components.cache.Cache;
import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.metadata.repository.MetadataSessionException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.AuthorizationException;
import org.apache.archiva.redback.system.DefaultSecuritySession;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.system.SecuritySystem;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManagerException;
import org.apache.archiva.redback.users.UserNotFoundException;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ContentNotFoundException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryNotFoundException;
import org.apache.archiva.repository.RepositoryRegistry;
@ -57,26 +61,25 @@ import org.apache.archiva.repository.content.ItemNotFoundException;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.content.Version;
import org.apache.archiva.repository.content.base.ArchivaItemSelector;
import org.apache.archiva.repository.storage.fs.FsStorageUtil;
import org.apache.archiva.repository.storage.RepositoryStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.metadata.audit.RepositoryListener;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.metadata.base.RepositoryMetadataWriter;
import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
import org.apache.archiva.repository.scanner.RepositoryScanner;
import org.apache.archiva.repository.scanner.RepositoryScannerException;
import org.apache.archiva.repository.scanner.RepositoryScannerInstance;
import org.apache.archiva.repository.storage.RepositoryStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FsStorageUtil;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
import org.apache.archiva.rest.api.model.StringList;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.indexing.maven.ArchivaIndexingTaskExecutor;
import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexException;
import org.apache.archiva.scheduler.indexing.DownloadRemoteIndexScheduler;
import org.apache.archiva.scheduler.indexing.maven.ArchivaIndexingTaskExecutor;
import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.apache.archiva.security.ArchivaSecurityException;
import org.apache.archiva.security.common.ArchivaRoleConstants;
@ -778,13 +781,6 @@ public class DefaultRepositoriesService
Version version1 = layout.getVersion( versionSelector );
String path = repository.toPath( version1 );
ArtifactReference artifactReference = new ArtifactReference();
artifactReference.setArtifactId( artifact.getArtifactId() );
artifactReference.setGroupId( artifact.getGroupId() );
artifactReference.setVersion( artifact.getVersion() );
artifactReference.setClassifier( artifact.getClassifier() );
artifactReference.setType( artifact.getType() );
ArchivaItemSelector selector = ArchivaItemSelector.builder( )
.withNamespace( artifact.getGroupId( ) )
.withProjectId( artifact.getArtifactId( ) )

View File

@ -31,7 +31,6 @@ import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.SnapshotVersion;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.Repository;
@ -517,15 +516,6 @@ public class DefaultFileUploadService
}
}
private ArtifactReference createArtifactRef(FileMetadata fileMetadata, String groupId, String artifactId, String version) {
ArtifactReference artifactReference = new ArtifactReference();
artifactReference.setArtifactId(artifactId);
artifactReference.setGroupId(groupId);
artifactReference.setVersion(version);
artifactReference.setClassifier(fileMetadata.getClassifier());
return artifactReference;
}
private ArchivaRepositoryMetadata getMetadata(StorageAsset metadataFile)
throws RepositoryMetadataException {
ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();

View File

@ -35,16 +35,16 @@ import org.apache.archiva.indexer.ArchivaIndexingContext;
import org.apache.archiva.indexer.merger.IndexMerger;
import org.apache.archiva.indexer.merger.IndexMergerException;
import org.apache.archiva.indexer.merger.IndexMergerRequest;
import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
import org.apache.archiva.indexer.merger.base.MergedRemoteIndexesTask;
import org.apache.archiva.indexer.merger.base.MergedRemoteIndexesTaskRequest;
import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
import org.apache.archiva.indexer.search.RepositorySearch;
import org.apache.archiva.indexer.search.RepositorySearchException;
import org.apache.archiva.metadata.audit.AuditListener;
import org.apache.archiva.metadata.model.facets.AuditEvent;
import org.apache.archiva.metadata.repository.storage.RelocationException;
import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
import org.apache.archiva.model.ArchivaRepositoryMetadata;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.proxy.ProxyRegistry;
import org.apache.archiva.proxy.model.RepositoryProxyHandler;
@ -58,10 +58,10 @@ import org.apache.archiva.redback.policy.MustChangePasswordException;
import org.apache.archiva.redback.system.SecuritySession;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.LayoutException;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.BaseRepositoryContentLayout;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.RepositoryGroup;
import org.apache.archiva.repository.RepositoryRegistry;
@ -69,14 +69,13 @@ import org.apache.archiva.repository.RepositoryRequestInfo;
import org.apache.archiva.repository.content.Artifact;
import org.apache.archiva.repository.content.ContentItem;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.metadata.audit.AuditListener;
import org.apache.archiva.repository.features.IndexCreationFeature;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.metadata.RepositoryMetadataException;
import org.apache.archiva.repository.metadata.base.MetadataTools;
import org.apache.archiva.repository.metadata.base.RepositoryMetadataMerge;
import org.apache.archiva.repository.metadata.base.RepositoryMetadataWriter;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FilesystemStorage;
import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
import org.apache.archiva.security.ServletAuthenticator;
import org.apache.archiva.webdav.util.MimeTypes;

View File

@ -19,14 +19,13 @@ package org.apache.archiva.metadata.repository.storage;
* under the License.
*/
import org.apache.archiva.filter.Filter;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.ProjectMetadata;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.filter.Filter;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.policies.ProxyDownloadException;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.content.ItemSelector;
import org.apache.archiva.xml.XMLException;