@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.
*/
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;

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.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 )

View 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

View 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

View 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

View 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() );

View 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 );

View 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() );

View 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
{