import org.apache.archiva.redback.components.registry.RegistryListener;
import org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.Predicate;
import org.apache.commons.configuration.CombinedConfiguration;
import org.apache.tools.ant.types.selectors.SelectorUtils;
if ( repositoryScanningConfiguration != null )
{
FileType filetype =
- (FileType) CollectionUtils.find( config.getRepositoryScanning().getFileTypes(), selectedFiletype );
+ IterableUtils.find( config.getRepositoryScanning().getFileTypes(), selectedFiletype );
if ( ( filetype != null ) && CollectionUtils.isNotEmpty( filetype.getPatterns() ) )
{
*
*
*/
+@SuppressWarnings( "deprecation" )
@RunWith( ArchivaBlockJUnit4ClassRunner.class )
public class ProxyConnectorConfigurationOrderComparatorTest
{
org.springframework*;version="[3,4)",
org.apache.archiva.redback.components.registry,
org.apache.archiva.metadata.model*;version=${project.version},
- org.apache.archiva.metadata.repository.storage.maven2*;version=${project.version},
org.slf4j;resolution:=optional
</Import-Package>
</instructions>
return remoteRepository;
}
+ @SuppressWarnings("unchecked")
@Override
public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException
{
}
@Override
- public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository ) throws RepositoryException
+ public ManagedRepositoryConfiguration getManagedConfiguration( ManagedRepository managedRepository )
{
ManagedRepositoryConfiguration configuration = new ManagedRepositoryConfiguration( );
configuration.setId( managedRepository.getId( ) );
@Override
- public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository ) throws RepositoryException
+ public RemoteRepositoryConfiguration getRemoteConfiguration( RemoteRepository remoteRepository )
{
RemoteRepositoryConfiguration configuration = new RemoteRepositoryConfiguration( );
configuration.setId( remoteRepository.getId( ) );
org.apache.archiva.common.plexusbridge;version=${project.version},
org.apache.commons.io;version="[1.4,2)",
org.apache.commons.lang*;version="[2.4,3)",
- org.apache.lucene*;version="[3,4)",
org.springframework*;version="[3,4)",
org.apache.maven.index*,
org.apache.archiva.redback.components.scheduler,
return remoteRepository;
}
+ @SuppressWarnings("unchecked")
@Override
public void updateRemoteInstance( EditableRemoteRepository remoteRepository, RemoteRepositoryConfiguration configuration ) throws RepositoryException
{
return IndexingContext.class.equals(clazz);
}
+ @SuppressWarnings( "unchecked" )
@Override
public <T> T getBaseContext(Class<T> clazz) throws UnsupportedOperationException {
if (IndexingContext.class.equals(clazz)) {
org.apache.archiva.admin.model.managed;version=${project.version},
org.apache.archiva.common;version=${project.version},
org.apache.archiva.configuration;version=${project.version},
- org.apache.archiva.metadata.repository*;version=${project.version},
org.apache.archiva.repository.scanner;version=${project.version},
org.apache.archiva.scheduler;version=${project.version},
org.apache.commons.lang;version="[2.4,3)",
org.codehaus.plexus.personality.plexus.lifecycle.phase,
org.apache.archiva.redback.components.taskqueue*,
org.apache.archiva.redback.components.scheduler,
- org.quartz*;version="[2,3)",
- org.springframework*;version="[3,4)",
org.slf4j;resolution:=optional
</Import-Package>
</instructions>
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor;
import org.apache.archiva.repository.ManagedRepository;
import org.apache.archiva.repository.RepositoryRegistry;
+import org.apache.archiva.scheduler.repository.model.RepositoryTask;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.codehaus.plexus.util.FileUtils;
import org.junit.After;
@Inject
@Named( value = "taskExecutor#test-repository-scanning" )
- protected TaskExecutor taskExecutor;
+ protected TaskExecutor<RepositoryTask> taskExecutor;
@Inject
@Named( value = "archivaConfiguration#test-repository-scanning" )
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.services.utils.AddAdminRepoConsumerClosure;
import org.apache.archiva.rest.services.utils.AdminRepositoryConsumerComparator;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
{
try
{
- return new ArrayList<String>( archivaAdministration.getKnownContentConsumers() );
+ return new ArrayList<>( archivaAdministration.getKnownContentConsumers( ) );
}
catch ( RepositoryAdminException e )
{
{
try
{
- return new ArrayList<String>( archivaAdministration.getInvalidContentConsumers() );
+ return new ArrayList<>( archivaAdministration.getInvalidContentConsumers( ) );
}
catch ( RepositoryAdminException e )
{
new AddAdminRepoConsumerClosure( archivaAdministration.getKnownContentConsumers() );
IterableUtils.forEach( repoConsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer );
List<AdminRepositoryConsumer> knownContentConsumers = addAdminRepoConsumer.getList();
- Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
+ knownContentConsumers.sort( AdminRepositoryConsumerComparator.getInstance( ) );
return knownContentConsumers;
}
catch ( RepositoryAdminException e )
new AddAdminRepoConsumerClosure( archivaAdministration.getInvalidContentConsumers() );
IterableUtils.forEach( repoConsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer );
List<AdminRepositoryConsumer> invalidContentConsumers = addAdminRepoConsumer.getList();
- Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() );
+ invalidContentConsumers.sort( AdminRepositoryConsumerComparator.getInstance( ) );
return invalidContentConsumers;
}
catch ( RepositoryAdminException e )
implements BrowseService
{
- private Charset ARTIFACT_CONTENT_ENCODING=Charset.forName( "UTF-8" );
+ private final Charset ARTIFACT_CONTENT_ENCODING=Charset.forName( "UTF-8" );
@Inject
private DependencyTreeBuilder dependencyTreeBuilder;
}
}
- public Cache getVersionMetadataCache()
+ public Cache<String, ProjectVersionMetadata> getVersionMetadataCache()
{
return versionMetadataCache;
}
- public void setVersionMetadataCache( Cache versionMetadataCache )
+ public void setVersionMetadataCache( Cache<String, ProjectVersionMetadata> versionMetadataCache )
{
this.versionMetadataCache = versionMetadataCache;
}
@Inject
@Named(value = "archivaTaskScheduler#repository")
- private ArchivaTaskScheduler scheduler;
+ private ArchivaTaskScheduler<RepositoryTask> scheduler;
@Inject
private DownloadRemoteIndexScheduler downloadRemoteIndexScheduler;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
}
}
+ // Used for generics
+ private class CacheEntryComparator implements Comparator<CacheEntry>
+ {
+
+ @Override
+ public int compare( CacheEntry o1, CacheEntry o2 )
+ {
+ return o1.compareTo( o2 );
+ }
+ }
+
@Override
public List<CacheEntry> getCacheEntries()
throws ArchivaRestServiceException
cacheStatistics.getInMemorySize() ) );
}
- Collections.sort( cacheEntries );
+ Collections.sort( cacheEntries, new CacheEntryComparator() );
return cacheEntries;
}
import java.util.List;
/**
- * AddAdminRepoConsumerClosure
- *
- *
+ * AddAdminRepoConsumerClosure
*/
public class AddAdminRepoConsumerClosure
- implements Closure
+ implements Closure<RepositoryContentConsumer>
{
- private List<AdminRepositoryConsumer> list = new ArrayList<>();
+ private List<AdminRepositoryConsumer> list = new ArrayList<>( );
private List<String> selectedIds;
}
@Override
- public void execute( Object input )
+ public void execute( RepositoryContentConsumer input )
{
- if ( input instanceof RepositoryContentConsumer )
- {
- RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
+ RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
- boolean enabled = this.selectedIds.contains( consumer.getId() );
- AdminRepositoryConsumer adminconsumer = new AdminRepositoryConsumer();
- adminconsumer.setEnabled( enabled );
- adminconsumer.setId( consumer.getId() );
- adminconsumer.setDescription( consumer.getDescription() );
+ boolean enabled = this.selectedIds.contains( consumer.getId( ) );
+ AdminRepositoryConsumer adminconsumer = new AdminRepositoryConsumer( );
+ adminconsumer.setEnabled( enabled );
+ adminconsumer.setId( consumer.getId( ) );
+ adminconsumer.setDescription( consumer.getDescription( ) );
- list.add( adminconsumer );
- }
+ list.add( adminconsumer );
}
- public List<AdminRepositoryConsumer> getList()
+ public List<AdminRepositoryConsumer> getList( )
{
return list;
}
@Inject
@Named(value = "archivaTaskScheduler#repository")
- private ArchivaTaskScheduler scheduler;
+ private ArchivaTaskScheduler<RepositoryTask> scheduler;
private String getStringValue( MultipartBody multipartBody, String attachmentId )
throws IOException
{
Attachment attachment = multipartBody.getAttachment( attachmentId );
- return attachment == null ? "" : IOUtils.toString( attachment.getDataHandler().getInputStream() );
+ return attachment == null ? "" : IOUtils.toString( attachment.getDataHandler().getInputStream(), "UTF-8" );
}
@Override
*/
protected synchronized List<FileMetadata> getSessionFilesList()
{
- List<FileMetadata> fileMetadatas =
- (List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY );
+ @SuppressWarnings("unchecked") List<FileMetadata> fileMetadatas = (List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY );
if ( fileMetadatas == null )
{
fileMetadatas = new CopyOnWriteArrayList<>();
public Boolean clearUploadedFiles()
throws ArchivaRestServiceException
{
- List<FileMetadata> fileMetadatas = new ArrayList( getSessionFileMetadatas() );
+ List<FileMetadata> fileMetadatas = new ArrayList<>( getSessionFileMetadatas() );
for ( FileMetadata fileMetadata : fileMetadatas )
{
deleteFile( Paths.get( fileMetadata.getServerFileName() ).toString() );
public List<FileMetadata> getSessionFileMetadatas()
throws ArchivaRestServiceException
{
- List<FileMetadata> fileMetadatas =
+ @SuppressWarnings("unchecked") List<FileMetadata> fileMetadatas =
(List<FileMetadata>) httpServletRequest.getSession().getAttribute( FILES_SESSION_KEY );
return fileMetadatas == null ? Collections.<FileMetadata>emptyList() : fileMetadatas;
org.joda.time*;version="[1.5,2)",
org.springframework*;version="[3,4)",
org.apache.maven.index*,
- org.apache.maven.model*,
org.codehaus.plexus.digest,
org.apache.archiva.redback.*,
org.apache.archiva.redback.components.taskqueue,
- org.codehaus.plexus.util*,
org.apache.archiva.common.filelock,
org.codehaus.redback.integration.filter.authentication,
org.slf4j;resolution:=optional,
public static final String COMPLIANCE_CLASS = "1, 2";
- private final ArchivaTaskScheduler scheduler;
+ private final ArchivaTaskScheduler<RepositoryTask> scheduler;
private final FileLockManager fileLockManager;
// set (or reset) fundamental properties
if ( getDisplayName() != null )
{
- properties.add( new DefaultDavProperty( DavPropertyName.DISPLAYNAME, getDisplayName() ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.DISPLAYNAME, getDisplayName() ) );
}
if ( isCollection() )
{
properties.add( new ResourceType( ResourceType.COLLECTION ) );
// Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "1" ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "1" ) );
}
else
{
properties.add( new ResourceType( ResourceType.DEFAULT_RESOURCE ) );
// Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "0" ) );
}
// Need to get the ISO8601 date for properties
DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
String modifiedDate = fmt.print( dt );
- properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );
- properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.CREATIONDATE, modifiedDate ) );
try
{
- properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, Files.size(localResource) ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.GETCONTENTLENGTH, Files.size(localResource) ) );
}
catch ( IOException e )
{
log.error("Could not get file size of {}: {}", localResource, e.getMessage(), e);
- properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, 0 ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.GETCONTENTLENGTH, 0 ) );
}
this.properties = properties;
// handle browse requests for virtual repos
if ( getLogicalResource( archivaLocator, null, true ).endsWith( "/" ) )
{
- try
- {
- DavResource davResource =
- getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
- repoGroupConfig );
+ DavResource davResource =
+ getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
+ repoGroupConfig );
- setHeaders( response, locator, davResource, true );
+ setHeaders( response, locator, davResource, true );
- return davResource;
+ return davResource;
- }
- catch ( RepositoryAdminException e )
- {
- throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
- }
}
else
{
private DavResource getResourceFromGroup( DavServletRequest request, List<String> repositories,
ArchivaDavResourceLocator locator,
RepositoryGroupConfiguration repositoryGroupConfiguration )
- throws DavException, RepositoryAdminException
+ throws DavException
{
if ( repositoryGroupConfiguration.getRepositories() == null
|| repositoryGroupConfiguration.getRepositories().isEmpty() )
{
HttpSession session = request.getSession();
- Map<String, TemporaryGroupIndex> temporaryGroupIndexMap =
+ @SuppressWarnings( "unchecked" ) Map<String, TemporaryGroupIndex> temporaryGroupIndexMap =
(Map<String, TemporaryGroupIndex>) session.getAttribute(
TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY );
if ( temporaryGroupIndexMap == null )
// set (or reset) fundamental properties
if ( getDisplayName() != null )
{
- properties.add( new DefaultDavProperty( DavPropertyName.DISPLAYNAME, getDisplayName() ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.DISPLAYNAME, getDisplayName() ) );
}
if ( isCollection() )
{
properties.add( new ResourceType( ResourceType.COLLECTION ) );
// Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "1" ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "1" ) );
}
else
{
properties.add( new ResourceType( ResourceType.DEFAULT_RESOURCE ) );
// Windows XP support
- properties.add( new DefaultDavProperty( DavPropertyName.ISCOLLECTION, "0" ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.ISCOLLECTION, "0" ) );
}
// Need to get the ISO8601 date for properties
DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
String modifiedDate = fmt.print( dt );
- properties.add( new DefaultDavProperty( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.GETLASTMODIFIED, modifiedDate ) );
- properties.add( new DefaultDavProperty( DavPropertyName.CREATIONDATE, modifiedDate ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.CREATIONDATE, modifiedDate ) );
- properties.add( new DefaultDavProperty( DavPropertyName.GETCONTENTLENGTH, 0 ) );
+ properties.add( new DefaultDavProperty<>( DavPropertyName.GETCONTENTLENGTH, 0 ) );
propsInitialized = true;
}
org.apache.archiva.admin.model.proxyconnector;version=${project.version},
org.apache.archiva.admin.model.remote;version=${project.version},
org.apache.commons.collections;version="[3.2,4)",
- org.apache.commons.io*;version="[1.4,2)",
org.apache.commons.configuration;version="[1.4,2)",
org.apache.commons.lang*;version="[2.4,3)",
org.apache.maven.artifact*,