diff options
author | Eric Barboni <skygo@apache.org> | 2014-04-11 02:58:29 +0200 |
---|---|---|
committer | Eric Barboni <skygo@apache.org> | 2014-04-11 02:58:29 +0200 |
commit | f23b74ade7d13e4442c7fa903fd9a6be003dae23 (patch) | |
tree | 67da9130b531d367052e73b19f21fa01ed5c491e /archiva-modules/archiva-base | |
parent | 90c5e0eb20a1369b085dceb02e3f14adaf68ede5 (diff) | |
download | archiva-f23b74ade7d13e4442c7fa903fd9a6be003dae23.tar.gz archiva-f23b74ade7d13e4442c7fa903fd9a6be003dae23.zip |
@Override + Diamond
Diffstat (limited to 'archiva-modules/archiva-base')
9 files changed, 58 insertions, 31 deletions
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java index bc39b8da4..225cc78e8 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java @@ -18,17 +18,10 @@ package org.apache.archiva.indexer.merger; * under the License. */ -import com.google.common.io.Files; - -import org.apache.archiva.admin.model.RepositoryAdminException; -import org.apache.archiva.admin.model.beans.RepositoryGroup; -import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; -import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.common.plexusbridge.MavenIndexerUtils; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.commons.io.FileUtils; -import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.StopWatch; import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.context.IndexingContext; @@ -64,7 +57,7 @@ public class DefaultIndexMerger private IndexPacker indexPacker; - private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>(); + private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<>(); private List<String> runningGroups = new CopyOnWriteArrayList<String>(); @@ -77,6 +70,7 @@ public class DefaultIndexMerger indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); } + @Override public IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest ) throws IndexMergerException { @@ -147,6 +141,7 @@ public class DefaultIndexMerger } @Async + @Override public void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex ) { if ( temporaryGroupIndex == null ) @@ -174,6 +169,7 @@ public class DefaultIndexMerger } } + @Override public Collection<TemporaryGroupIndex> getTemporaryGroupIndexes() { return this.temporaryGroupIndexes; diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java index 776253d99..20fe232f5 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java @@ -20,7 +20,6 @@ package org.apache.archiva.indexer.merger; */ import org.apache.archiva.admin.model.beans.RepositoryGroup; -import org.apache.archiva.admin.model.group.RepositoryGroupAdmin; import org.apache.archiva.scheduler.MergedRemoteIndexesScheduler; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; @@ -55,7 +54,7 @@ public class DefaultMergedRemoteIndexesScheduler @Inject private IndexMerger indexMerger; - private Map<String, ScheduledFuture> scheduledFutureMap = new ConcurrentHashMap<String, ScheduledFuture>(); + private Map<String, ScheduledFuture> scheduledFutureMap = new ConcurrentHashMap<>(); @Override public void schedule( RepositoryGroup repositoryGroup, File directory ) diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java index 1209410b7..708268e1c 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java @@ -181,12 +181,7 @@ public class IndexMergerRequest IndexMergerRequest that = (IndexMergerRequest) o; - if ( !groupId.equals( that.groupId ) ) - { - return false; - } - - return true; + return groupId.equals( that.groupId ); } @Override diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java index bcb39051b..c67d31286 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java @@ -78,12 +78,7 @@ public class MergedRemoteIndexesTask MergedRemoteIndexesTask that = (MergedRemoteIndexesTask) o; - if ( !mergedRemoteIndexesTaskRequest.equals( that.mergedRemoteIndexesTaskRequest ) ) - { - return false; - } - - return true; + return mergedRemoteIndexesTaskRequest.equals( that.mergedRemoteIndexesTaskRequest ); } @Override diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java index 57219f752..bc0663dbc 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java @@ -69,12 +69,7 @@ public class MergedRemoteIndexesTaskRequest MergedRemoteIndexesTaskRequest that = (MergedRemoteIndexesTaskRequest) o; - if ( !indexMergerRequest.equals( that.indexMergerRequest ) ) - { - return false; - } - - return true; + return indexMergerRequest.equals( that.indexMergerRequest ); } @Override diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java index 7e2fb57e2..235c8503b 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java @@ -91,6 +91,7 @@ public class MavenRepositorySearch /** * @see RepositorySearch#search(String, List, String, SearchResultLimits, List) */ + @Override public SearchResults search( String principal, List<String> selectedRepos, String term, SearchResultLimits limits, List<String> previousSearchTerms ) throws RepositorySearchException @@ -130,6 +131,7 @@ public class MavenRepositorySearch /** * @see RepositorySearch#search(String, SearchFields, SearchResultLimits) */ + @Override public SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits ) throws RepositorySearchException { @@ -328,7 +330,7 @@ public class MavenRepositorySearch */ private List<String> addIndexingContexts( List<String> selectedRepos ) { - Set<String> indexingContextIds = new HashSet<String>(); + Set<String> indexingContextIds = new HashSet<>(); for ( String repo : selectedRepos ) { try @@ -367,10 +369,11 @@ public class MavenRepositorySearch } + @Override public Set<String> getRemoteIndexingContextIds( String managedRepoId ) throws RepositoryAdminException { - Set<String> ids = new HashSet<String>(); + Set<String> ids = new HashSet<>(); List<ProxyConnector> proxyConnectors = proxyConnectorAdmin.getProxyConnectorAsMap().get( managedRepoId ); @@ -392,6 +395,7 @@ public class MavenRepositorySearch return ids; } + @Override public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) throws RepositorySearchException { @@ -404,7 +408,7 @@ public class MavenRepositorySearch try { - Set<String> allGroupIds = new HashSet<String>(); + Set<String> allGroupIds = new HashSet<>(); for ( IndexingContext indexingContext : indexContexts ) { allGroupIds.addAll( indexingContext.getAllGroups() ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java index d34f0b7ad..6068aa720 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java @@ -35,6 +35,7 @@ public class NoClassifierArtifactInfoFilter public static final List<? extends ArtifactInfoFilter> LIST = Arrays.asList( INSTANCE ); + @Override public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult ) { return StringUtils.isBlank( artifact.classifier ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java index c129fe936..461a4d76b 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java @@ -87,6 +87,7 @@ public abstract class AbstractMavenRepositorySearch NexusIndexer nexusIndexer; @Before + @Override public void setUp() throws Exception { @@ -126,6 +127,7 @@ public abstract class AbstractMavenRepositorySearch } @After + @Override public void tearDown() throws Exception { @@ -235,21 +237,25 @@ public abstract class AbstractMavenRepositorySearch { protected Logger log = LoggerFactory.getLogger( getClass() ); + @Override public void scanningStarted( IndexingContext ctx ) { } + @Override public void scanningFinished( IndexingContext ctx, ScanningResult result ) { } + @Override public void artifactError( ArtifactContext ac, Exception e ) { log.debug( "artifactError {}", ac.getArtifact().getPath(), e ); } + @Override public void artifactDiscovered( ArtifactContext ac ) { log.debug( "artifactDiscovered {}:{}", ac.getArtifact().getPath(), ac.getArtifactInfo() ); diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java index 0fd0ae27b..6b43a3a10 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java @@ -42,6 +42,7 @@ import java.util.List; public class MockRepositorySessionFactory implements RepositorySessionFactory { + @Override public RepositorySession createSession() { return new RepositorySession( null, null ) @@ -64,12 +65,14 @@ public class MockRepositorySessionFactory return new MetadataRepository() { + @Override public boolean hasMetadataFacet( String repositoryId, String facetId ) throws MetadataRepositoryException { return false; } + @Override public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion, MetadataFacet metadataFacet ) throws MetadataRepositoryException @@ -77,18 +80,21 @@ public class MockRepositorySessionFactory } + @Override public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion ) throws MetadataRepositoryException { throw new UnsupportedOperationException(); } + @Override public void updateProject( String repositoryId, ProjectMetadata project ) throws MetadataRepositoryException { //To change body of implemented methods use File | Settings | File Templates. } + @Override public void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion, ArtifactMetadata artifactMeta ) throws MetadataRepositoryException @@ -96,6 +102,7 @@ public class MockRepositorySessionFactory //To change body of implemented methods use File | Settings | File Templates. } + @Override public void updateProjectVersion( String repositoryId, String namespace, String projectId, ProjectVersionMetadata versionMetadata ) throws MetadataRepositoryException @@ -103,42 +110,49 @@ public class MockRepositorySessionFactory //To change body of implemented methods use File | Settings | File Templates. } + @Override public void updateNamespace( String repositoryId, String namespace ) throws MetadataRepositoryException { //To change body of implemented methods use File | Settings | File Templates. } + @Override public List<String> getMetadataFacets( String repositoryId, String facetId ) throws MetadataRepositoryException { return Collections.emptyList(); } + @Override public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) throws MetadataRepositoryException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet ) throws MetadataRepositoryException { //To change body of implemented methods use File | Settings | File Templates. } + @Override public void removeMetadataFacets( String repositoryId, String facetId ) throws MetadataRepositoryException { //To change body of implemented methods use File | Settings | File Templates. } + @Override public void removeMetadataFacet( String repositoryId, String facetId, String name ) throws MetadataRepositoryException { //To change body of implemented methods use File | Settings | File Templates. } + @Override public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime, Date endTime ) throws MetadataRepositoryException @@ -146,18 +160,21 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<String> getRepositories() throws MetadataRepositoryException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum ) throws MetadataRepositoryException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public void removeArtifact( String repositoryId, String namespace, String project, String version, String id ) throws MetadataRepositoryException @@ -165,24 +182,28 @@ public class MockRepositorySessionFactory //To change body of implemented methods use File | Settings | File Templates. } + @Override public void removeRepository( String repositoryId ) throws MetadataRepositoryException { //To change body of implemented methods use File | Settings | File Templates. } + @Override public List<ArtifactMetadata> getArtifacts( String repositoryId ) throws MetadataRepositoryException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public ProjectMetadata getProject( String repoId, String namespace, String projectId ) throws MetadataResolutionException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataResolutionException @@ -190,6 +211,7 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataResolutionException @@ -197,6 +219,7 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId, String projectVersion ) @@ -205,30 +228,35 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<String> getRootNamespaces( String repoId ) throws MetadataResolutionException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<String> getNamespaces( String repoId, String namespace ) throws MetadataResolutionException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<String> getProjects( String repoId, String namespace ) throws MetadataResolutionException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) throws MetadataResolutionException { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataResolutionException @@ -236,37 +264,44 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public void save() { //To change body of implemented methods use File | Settings | File Templates. } + @Override public void close() { //To change body of implemented methods use File | Settings | File Templates. } + @Override public void revert() { //To change body of implemented methods use File | Settings | File Templates. } + @Override public boolean canObtainAccess( Class<?> aClass ) { return false; //To change body of implemented methods use File | Settings | File Templates. } + @Override public <T>T obtainAccess( Class<T> aClass ) { return null; //To change body of implemented methods use File | Settings | File Templates. } + @Override public void removeNamespace( String repositoryId, String namespace ) throws MetadataRepositoryException { } + @Override public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataRepositoryException @@ -274,6 +309,7 @@ public class MockRepositorySessionFactory } + @Override public void removeProject( String repositoryId, String namespace, String projectId ) throws MetadataRepositoryException { |