mirror of https://github.com/apache/archiva.git
[MRM-1490] REST services : expose repository scanning configuration
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1167218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8566f7a26c
commit
18a5202231
|
@ -101,4 +101,15 @@ public class LegacyArtifactPath
|
|||
{
|
||||
return artifact.split( ":" )[4];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append( "LegacyArtifactPath" );
|
||||
sb.append( "{path='" ).append( path ).append( '\'' );
|
||||
sb.append( ", artifact='" ).append( artifact ).append( '\'' );
|
||||
sb.append( '}' );
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,9 @@ package org.apache.archiva.rest.api.services;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.rest.api.model.FileType;
|
||||
import org.apache.archiva.rest.api.model.LegacyArtifactPath;
|
||||
import org.apache.archiva.rest.api.model.RepositoryScanning;
|
||||
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
|
||||
|
||||
|
@ -60,4 +62,97 @@ public interface ArchivaAdministrationService
|
|||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "getRepositoryScanning" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
RepositoryScanning getRepositoryScanning()
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "updateRepositoryScanning" )
|
||||
@POST
|
||||
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
void updateRepositoryScanning( RepositoryScanning repositoryScanning )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "addFileTypePattern" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "removeFileTypePattern" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
|
||||
@QueryParam( "pattern" ) String pattern )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "getFileType" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
FileType getFileType( String fileTypeId )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "addFileType" )
|
||||
@POST
|
||||
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
void addFileType( FileType fileType )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "removeFileType" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "addKnownContentConsumer" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean addKnownContentConsumer( @QueryParam( "knownContentConsumer" ) String knownContentConsumer )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "setKnownContentConsumers" )
|
||||
@POST
|
||||
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
void setKnownContentConsumers( List<String> knownContentConsumers )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
|
||||
@Path( "removeKnownContentConsumer" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean removeKnownContentConsumer( @QueryParam( "knownContentConsumer" ) String knownContentConsumer )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "addInvalidContentConsumer" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean addInvalidContentConsumer(@QueryParam( "invalidContentConsumer" ) String invalidContentConsumer )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "setInvalidContentConsumers" )
|
||||
@POST
|
||||
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
void setInvalidContentConsumers( List<String> invalidContentConsumers )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
@Path( "removeInvalidContentConsumer" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
|
||||
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
|
||||
Boolean removeInvalidContentConsumer(@QueryParam( "invalidContentConsumer" ) String invalidContentConsumer )
|
||||
throws RepositoryAdminException;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,9 @@ package org.apache.archiva.rest.services;
|
|||
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
||||
import org.apache.archiva.admin.repository.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.repository.admin.ArchivaAdministration;
|
||||
import org.apache.archiva.rest.api.model.FileType;
|
||||
import org.apache.archiva.rest.api.model.LegacyArtifactPath;
|
||||
import org.apache.archiva.rest.api.model.RepositoryScanning;
|
||||
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -67,4 +69,100 @@ public class DefaultArchivaAdministrationService
|
|||
archivaAdministration.deleteLegacyArtifactPath( path, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public RepositoryScanning getRepositoryScanning()
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
return new BeanReplicator().replicateBean( archivaAdministration.getRepositoryScanning(),
|
||||
RepositoryScanning.class );
|
||||
}
|
||||
|
||||
public void updateRepositoryScanning( RepositoryScanning repositoryScanning )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.updateRepositoryScanning( new BeanReplicator().replicateBean( getRepositoryScanning(),
|
||||
org.apache.archiva.admin.repository.admin.RepositoryScanning.class ),
|
||||
getAuditInformation() );
|
||||
}
|
||||
|
||||
public Boolean addFileTypePattern( String fileTypeId, String pattern )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.addFileTypePattern( fileTypeId, pattern, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean removeFileTypePattern( String fileTypeId, String pattern )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.removeFileTypePattern( fileTypeId, pattern, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public FileType getFileType( String fileTypeId )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
org.apache.archiva.admin.repository.admin.FileType fileType = archivaAdministration.getFileType( fileTypeId );
|
||||
if ( fileType == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new BeanReplicator().replicateBean( fileType, FileType.class );
|
||||
}
|
||||
|
||||
public void addFileType( FileType fileType )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.addFileType(
|
||||
new BeanReplicator().replicateBean( fileType, org.apache.archiva.admin.repository.admin.FileType.class ),
|
||||
getAuditInformation() );
|
||||
|
||||
}
|
||||
|
||||
public Boolean removeFileType( String fileTypeId )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.removeFileType( fileTypeId, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean addKnownContentConsumer( String knownContentConsumer )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.addKnownContentConsumer( knownContentConsumer, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public void setKnownContentConsumers( List<String> knownContentConsumers )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.setKnownContentConsumers( knownContentConsumers, getAuditInformation() );
|
||||
}
|
||||
|
||||
public Boolean removeKnownContentConsumer( String knownContentConsumer )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.removeKnownContentConsumer( knownContentConsumer, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public Boolean addInvalidContentConsumer( String invalidContentConsumer )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.addInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
public void setInvalidContentConsumers( List<String> invalidContentConsumers )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.setInvalidContentConsumers( invalidContentConsumers, getAuditInformation() );
|
||||
}
|
||||
|
||||
public Boolean removeInvalidContentConsumer( String invalidContentConsumer )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
archivaAdministration.removeInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue