]> source.dussan.org Git - archiva.git/commitdiff
@Override + Diamond
authorEric Barboni <skygo@apache.org>
Fri, 11 Apr 2014 00:58:29 +0000 (02:58 +0200)
committerEric Barboni <skygo@apache.org>
Fri, 11 Apr 2014 00:58:29 +0000 (02:58 +0200)
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultIndexMerger.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/DefaultMergedRemoteIndexesScheduler.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/IndexMergerRequest.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTask.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/merger/MergedRemoteIndexesTaskRequest.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/MavenRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/NoClassifierArtifactInfoFilter.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/AbstractMavenRepositorySearch.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java

index bc39b8da4056bf294076e91f489e8daa2d6d2bba..225cc78e8a1864efdec0e22e36df757b499d6cd3 100644 (file)
@@ -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;
index 776253d99b04b71fc7fd1ab3fd6fb52fc235aaa1..20fe232f593d980e16c34e56446919e20331a880 100644 (file)
@@ -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 )
index 1209410b770801f9a4994c88a06f9cb14a3db05f..708268e1c7f0243894e87ee2a86fc96a2984e662 100644 (file)
@@ -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
index bcb39051bfb47a09fe195293d8d86db5a3fd5002..c67d31286dd1a9ebd9c9ade19000eb2401348ffb 100644 (file)
@@ -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
index 57219f752013e74b5af51a36edfe9bba7afae94d..bc0663dbcead0b0c762bea98880bbae0c5bcd846 100644 (file)
@@ -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
index 7e2fb57e227827f01822d3b6c0e5280eaf759ff4..235c8503b6f94e428b7767f9aa38398764a6690d 100644 (file)
@@ -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() );
index d34f0b7ad80518f7d3a32a284cdfda2214901095..6068aa72040ec8aee89f4457b738d37f80c6160b 100644 (file)
@@ -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 );
index c129fe936860f1109f13faaa91d92d1b573433e3..461a4d76b720de8647944dcd484811dfa77455f6 100644 (file)
@@ -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() );
index 0fd0ae27b0834ac032772434bfb59fed10af7207..6b43a3a10651a4ede151e46f0b6f4fe64d0b2994 100644 (file)
@@ -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
                     {