@Override + Diamond

This commit is contained in:
Eric Barboni 2014-04-11 02:58:29 +02:00
parent 90c5e0eb20
commit f23b74ade7
9 changed files with 58 additions and 31 deletions

View File

@ -18,17 +18,10 @@ package org.apache.archiva.indexer.merger;
* under the License. * 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.MavenIndexerUtils;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException; import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.StopWatch; import org.apache.commons.lang.time.StopWatch;
import org.apache.maven.index.NexusIndexer; import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexingContext; import org.apache.maven.index.context.IndexingContext;
@ -64,7 +57,7 @@ public class DefaultIndexMerger
private IndexPacker indexPacker; private IndexPacker indexPacker;
private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<TemporaryGroupIndex>(); private List<TemporaryGroupIndex> temporaryGroupIndexes = new CopyOnWriteArrayList<>();
private List<String> runningGroups = new CopyOnWriteArrayList<String>(); private List<String> runningGroups = new CopyOnWriteArrayList<String>();
@ -77,6 +70,7 @@ public class DefaultIndexMerger
indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" ); indexPacker = plexusSisuBridge.lookup( IndexPacker.class, "default" );
} }
@Override
public IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest ) public IndexingContext buildMergedIndex( IndexMergerRequest indexMergerRequest )
throws IndexMergerException throws IndexMergerException
{ {
@ -147,6 +141,7 @@ public class DefaultIndexMerger
} }
@Async @Async
@Override
public void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex ) public void cleanTemporaryGroupIndex( TemporaryGroupIndex temporaryGroupIndex )
{ {
if ( temporaryGroupIndex == null ) if ( temporaryGroupIndex == null )
@ -174,6 +169,7 @@ public class DefaultIndexMerger
} }
} }
@Override
public Collection<TemporaryGroupIndex> getTemporaryGroupIndexes() public Collection<TemporaryGroupIndex> getTemporaryGroupIndexes()
{ {
return this.temporaryGroupIndexes; return this.temporaryGroupIndexes;

View 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.beans.RepositoryGroup;
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
import org.apache.archiva.scheduler.MergedRemoteIndexesScheduler; import org.apache.archiva.scheduler.MergedRemoteIndexesScheduler;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -55,7 +54,7 @@ public class DefaultMergedRemoteIndexesScheduler
@Inject @Inject
private IndexMerger indexMerger; private IndexMerger indexMerger;
private Map<String, ScheduledFuture> scheduledFutureMap = new ConcurrentHashMap<String, ScheduledFuture>(); private Map<String, ScheduledFuture> scheduledFutureMap = new ConcurrentHashMap<>();
@Override @Override
public void schedule( RepositoryGroup repositoryGroup, File directory ) public void schedule( RepositoryGroup repositoryGroup, File directory )

View File

@ -181,12 +181,7 @@ public class IndexMergerRequest
IndexMergerRequest that = (IndexMergerRequest) o; IndexMergerRequest that = (IndexMergerRequest) o;
if ( !groupId.equals( that.groupId ) ) return groupId.equals( that.groupId );
{
return false;
}
return true;
} }
@Override @Override

View File

@ -78,12 +78,7 @@ public class MergedRemoteIndexesTask
MergedRemoteIndexesTask that = (MergedRemoteIndexesTask) o; MergedRemoteIndexesTask that = (MergedRemoteIndexesTask) o;
if ( !mergedRemoteIndexesTaskRequest.equals( that.mergedRemoteIndexesTaskRequest ) ) return mergedRemoteIndexesTaskRequest.equals( that.mergedRemoteIndexesTaskRequest );
{
return false;
}
return true;
} }
@Override @Override

View File

@ -69,12 +69,7 @@ public class MergedRemoteIndexesTaskRequest
MergedRemoteIndexesTaskRequest that = (MergedRemoteIndexesTaskRequest) o; MergedRemoteIndexesTaskRequest that = (MergedRemoteIndexesTaskRequest) o;
if ( !indexMergerRequest.equals( that.indexMergerRequest ) ) return indexMergerRequest.equals( that.indexMergerRequest );
{
return false;
}
return true;
} }
@Override @Override

View File

@ -91,6 +91,7 @@ public class MavenRepositorySearch
/** /**
* @see RepositorySearch#search(String, List, String, SearchResultLimits, List) * @see RepositorySearch#search(String, List, String, SearchResultLimits, List)
*/ */
@Override
public SearchResults search( String principal, List<String> selectedRepos, String term, SearchResultLimits limits, public SearchResults search( String principal, List<String> selectedRepos, String term, SearchResultLimits limits,
List<String> previousSearchTerms ) List<String> previousSearchTerms )
throws RepositorySearchException throws RepositorySearchException
@ -130,6 +131,7 @@ public class MavenRepositorySearch
/** /**
* @see RepositorySearch#search(String, SearchFields, SearchResultLimits) * @see RepositorySearch#search(String, SearchFields, SearchResultLimits)
*/ */
@Override
public SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits ) public SearchResults search( String principal, SearchFields searchFields, SearchResultLimits limits )
throws RepositorySearchException throws RepositorySearchException
{ {
@ -328,7 +330,7 @@ public class MavenRepositorySearch
*/ */
private List<String> addIndexingContexts( List<String> selectedRepos ) private List<String> addIndexingContexts( List<String> selectedRepos )
{ {
Set<String> indexingContextIds = new HashSet<String>(); Set<String> indexingContextIds = new HashSet<>();
for ( String repo : selectedRepos ) for ( String repo : selectedRepos )
{ {
try try
@ -367,10 +369,11 @@ public class MavenRepositorySearch
} }
@Override
public Set<String> getRemoteIndexingContextIds( String managedRepoId ) public Set<String> getRemoteIndexingContextIds( String managedRepoId )
throws RepositoryAdminException throws RepositoryAdminException
{ {
Set<String> ids = new HashSet<String>(); Set<String> ids = new HashSet<>();
List<ProxyConnector> proxyConnectors = proxyConnectorAdmin.getProxyConnectorAsMap().get( managedRepoId ); List<ProxyConnector> proxyConnectors = proxyConnectorAdmin.getProxyConnectorAsMap().get( managedRepoId );
@ -392,6 +395,7 @@ public class MavenRepositorySearch
return ids; return ids;
} }
@Override
public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos ) public Collection<String> getAllGroupIds( String principal, List<String> selectedRepos )
throws RepositorySearchException throws RepositorySearchException
{ {
@ -404,7 +408,7 @@ public class MavenRepositorySearch
try try
{ {
Set<String> allGroupIds = new HashSet<String>(); Set<String> allGroupIds = new HashSet<>();
for ( IndexingContext indexingContext : indexContexts ) for ( IndexingContext indexingContext : indexContexts )
{ {
allGroupIds.addAll( indexingContext.getAllGroups() ); allGroupIds.addAll( indexingContext.getAllGroups() );

View File

@ -35,6 +35,7 @@ public class NoClassifierArtifactInfoFilter
public static final List<? extends ArtifactInfoFilter> LIST = Arrays.asList( INSTANCE ); public static final List<? extends ArtifactInfoFilter> LIST = Arrays.asList( INSTANCE );
@Override
public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult ) public boolean addArtifactInResult( ArtifactInfo artifact, Map<String, SearchResultHit> currentResult )
{ {
return StringUtils.isBlank( artifact.classifier ); return StringUtils.isBlank( artifact.classifier );

View File

@ -87,6 +87,7 @@ public abstract class AbstractMavenRepositorySearch
NexusIndexer nexusIndexer; NexusIndexer nexusIndexer;
@Before @Before
@Override
public void setUp() public void setUp()
throws Exception throws Exception
{ {
@ -126,6 +127,7 @@ public abstract class AbstractMavenRepositorySearch
} }
@After @After
@Override
public void tearDown() public void tearDown()
throws Exception throws Exception
{ {
@ -235,21 +237,25 @@ public abstract class AbstractMavenRepositorySearch
{ {
protected Logger log = LoggerFactory.getLogger( getClass() ); protected Logger log = LoggerFactory.getLogger( getClass() );
@Override
public void scanningStarted( IndexingContext ctx ) public void scanningStarted( IndexingContext ctx )
{ {
} }
@Override
public void scanningFinished( IndexingContext ctx, ScanningResult result ) public void scanningFinished( IndexingContext ctx, ScanningResult result )
{ {
} }
@Override
public void artifactError( ArtifactContext ac, Exception e ) public void artifactError( ArtifactContext ac, Exception e )
{ {
log.debug( "artifactError {}", ac.getArtifact().getPath(), e ); log.debug( "artifactError {}", ac.getArtifact().getPath(), e );
} }
@Override
public void artifactDiscovered( ArtifactContext ac ) public void artifactDiscovered( ArtifactContext ac )
{ {
log.debug( "artifactDiscovered {}:{}", ac.getArtifact().getPath(), ac.getArtifactInfo() ); log.debug( "artifactDiscovered {}:{}", ac.getArtifact().getPath(), ac.getArtifactInfo() );

View File

@ -42,6 +42,7 @@ import java.util.List;
public class MockRepositorySessionFactory public class MockRepositorySessionFactory
implements RepositorySessionFactory implements RepositorySessionFactory
{ {
@Override
public RepositorySession createSession() public RepositorySession createSession()
{ {
return new RepositorySession( null, null ) return new RepositorySession( null, null )
@ -64,12 +65,14 @@ public class MockRepositorySessionFactory
return new MetadataRepository() return new MetadataRepository()
{ {
@Override
public boolean hasMetadataFacet( String repositoryId, String facetId ) public boolean hasMetadataFacet( String repositoryId, String facetId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
return false; return false;
} }
@Override
public void removeArtifact( String repositoryId, String namespace, String project, public void removeArtifact( String repositoryId, String namespace, String project,
String projectVersion, MetadataFacet metadataFacet ) String projectVersion, MetadataFacet metadataFacet )
throws MetadataRepositoryException throws MetadataRepositoryException
@ -77,18 +80,21 @@ public class MockRepositorySessionFactory
} }
@Override
public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion ) public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override
public void updateProject( String repositoryId, ProjectMetadata project ) public void updateProject( String repositoryId, ProjectMetadata project )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void updateArtifact( String repositoryId, String namespace, String projectId, public void updateArtifact( String repositoryId, String namespace, String projectId,
String projectVersion, ArtifactMetadata artifactMeta ) String projectVersion, ArtifactMetadata artifactMeta )
throws MetadataRepositoryException throws MetadataRepositoryException
@ -96,6 +102,7 @@ public class MockRepositorySessionFactory
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void updateProjectVersion( String repositoryId, String namespace, String projectId, public void updateProjectVersion( String repositoryId, String namespace, String projectId,
ProjectVersionMetadata versionMetadata ) ProjectVersionMetadata versionMetadata )
throws MetadataRepositoryException throws MetadataRepositoryException
@ -103,42 +110,49 @@ public class MockRepositorySessionFactory
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void updateNamespace( String repositoryId, String namespace ) public void updateNamespace( String repositoryId, String namespace )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public List<String> getMetadataFacets( String repositoryId, String facetId ) public List<String> getMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
return Collections.emptyList(); return Collections.emptyList();
} }
@Override
public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet ) public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void removeMetadataFacets( String repositoryId, String facetId ) public void removeMetadataFacets( String repositoryId, String facetId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void removeMetadataFacet( String repositoryId, String facetId, String name ) public void removeMetadataFacet( String repositoryId, String facetId, String name )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime, public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
Date endTime ) Date endTime )
throws MetadataRepositoryException throws MetadataRepositoryException
@ -146,18 +160,21 @@ public class MockRepositorySessionFactory
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<String> getRepositories() public Collection<String> getRepositories()
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum ) public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. 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, public void removeArtifact( String repositoryId, String namespace, String project, String version,
String id ) String id )
throws MetadataRepositoryException throws MetadataRepositoryException
@ -165,24 +182,28 @@ public class MockRepositorySessionFactory
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void removeRepository( String repositoryId ) public void removeRepository( String repositoryId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public List<ArtifactMetadata> getArtifacts( String repositoryId ) public List<ArtifactMetadata> getArtifacts( String repositoryId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public ProjectMetadata getProject( String repoId, String namespace, String projectId ) public ProjectMetadata getProject( String repoId, String namespace, String projectId )
throws MetadataResolutionException throws MetadataResolutionException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
throws MetadataResolutionException throws MetadataResolutionException
@ -190,6 +211,7 @@ public class MockRepositorySessionFactory
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
throws MetadataResolutionException throws MetadataResolutionException
@ -197,6 +219,7 @@ public class MockRepositorySessionFactory
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
String projectId, String projectId,
String projectVersion ) String projectVersion )
@ -205,30 +228,35 @@ public class MockRepositorySessionFactory
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<String> getRootNamespaces( String repoId ) public Collection<String> getRootNamespaces( String repoId )
throws MetadataResolutionException throws MetadataResolutionException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<String> getNamespaces( String repoId, String namespace ) public Collection<String> getNamespaces( String repoId, String namespace )
throws MetadataResolutionException throws MetadataResolutionException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<String> getProjects( String repoId, String namespace ) public Collection<String> getProjects( String repoId, String namespace )
throws MetadataResolutionException throws MetadataResolutionException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
throws MetadataResolutionException throws MetadataResolutionException
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId, public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
throws MetadataResolutionException throws MetadataResolutionException
@ -236,37 +264,44 @@ public class MockRepositorySessionFactory
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void save() public void save()
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void close() public void close()
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void revert() public void revert()
{ {
//To change body of implemented methods use File | Settings | File Templates. //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public boolean canObtainAccess( Class<?> aClass ) public boolean canObtainAccess( Class<?> aClass )
{ {
return false; //To change body of implemented methods use File | Settings | File Templates. return false; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public <T>T obtainAccess( Class<T> aClass ) public <T>T obtainAccess( Class<T> aClass )
{ {
return null; //To change body of implemented methods use File | Settings | File Templates. return null; //To change body of implemented methods use File | Settings | File Templates.
} }
@Override
public void removeNamespace( String repositoryId, String namespace ) public void removeNamespace( String repositoryId, String namespace )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {
} }
@Override
public void removeProjectVersion( String repoId, String namespace, String projectId, public void removeProjectVersion( String repoId, String namespace, String projectId,
String projectVersion ) String projectVersion )
throws MetadataRepositoryException throws MetadataRepositoryException
@ -274,6 +309,7 @@ public class MockRepositorySessionFactory
} }
@Override
public void removeProject( String repositoryId, String namespace, String projectId ) public void removeProject( String repositoryId, String namespace, String projectId )
throws MetadataRepositoryException throws MetadataRepositoryException
{ {