<artifactId>archiva-security</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-admin</artifactId>
- </dependency>
-
<dependency>
<groupId>org.codehaus.redback</groupId>
<artifactId>redback-authorization-api</artifactId>
* under the License.
*/
-import org.apache.archiva.admin.repository.admin.FileType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
// no op
}
- public RepositoryScanning( List<FileType> fileTypes,
- List<String> knownContentConsumers, List<String> invalidContentConsumers )
+ public RepositoryScanning( List<FileType> fileTypes, List<String> knownContentConsumers,
+ List<String> invalidContentConsumers )
{
this.fileTypes = fileTypes;
this.knownContentConsumers = knownContentConsumers;
* under the License.
*/
-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;
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
List<LegacyArtifactPath> getLegacyArtifactPaths()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "addLegacyArtifactPath" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "deleteLegacyArtifactPath" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "getRepositoryScanning" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
RepositoryScanning getRepositoryScanning()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "updateRepositoryScanning" )
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void updateRepositoryScanning( RepositoryScanning repositoryScanning )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@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;
+ throws ArchivaRestServiceException;
@Path( "removeFileTypePattern" )
@GET
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
@QueryParam( "pattern" ) String pattern )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@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;
+ throws ArchivaRestServiceException;
@Path( "addFileType" )
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void addFileType( FileType fileType )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@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;
+ throws ArchivaRestServiceException;
@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;
+ throws ArchivaRestServiceException;
@Path( "setKnownContentConsumers" )
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void setKnownContentConsumers( List<String> knownContentConsumers )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "removeKnownContentConsumer" )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean removeKnownContentConsumer( @QueryParam( "knownContentConsumer" ) String knownContentConsumer )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@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;
+ throws ArchivaRestServiceException;
@Path( "setInvalidContentConsumers" )
@POST
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void setInvalidContentConsumers( List<String> invalidContentConsumers )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@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;
+ throws ArchivaRestServiceException;
}
* under the License.
*/
-import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.rest.api.model.ManagedRepository;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
List<ManagedRepository> getManagedRepositories()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "getManagedRepository/{repositoryId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
ManagedRepository getManagedRepository( @PathParam( "repositoryId" ) String repositoryId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "deleteManagedRepository" )
@GET
* under the License.
*/
-import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.rest.api.model.NetworkProxy;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
List<NetworkProxy> getNetworkProxies()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "getNetworkProxy/{networkProxyId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
NetworkProxy getNetworkProxy( @PathParam( "networkProxyId" ) String networkProxyId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "addNetworkProxy" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void addNetworkProxy( NetworkProxy networkProxy )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "updateNetworkProxy" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
void updateNetworkProxy( NetworkProxy networkProxy )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "deleteNetworkProxy/{networkProxyId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteNetworkProxy( @PathParam( "networkProxyId" ) String networkProxyId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
}
* under the License.
*/
-import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.rest.api.model.ProxyConnector;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
List<ProxyConnector> getProxyConnectors()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "getProxyConnector" )
@GET
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
ProxyConnector getProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId,
@QueryParam( "targetRepoId" ) String targetRepoId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "addProxyConnector" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addProxyConnector( ProxyConnector proxyConnector )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "deleteProxyConnector" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteProxyConnector( ProxyConnector proxyConnector )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
/**
* <b>only for enabled/disable or changing bean values except target/source</b>
*
* @param proxyConnector
* @return
- * @throws org.apache.archiva.admin.repository.RepositoryAdminException
*
*/
@Path( "updateProxyConnector" )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateProxyConnector( ProxyConnector proxyConnector )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
}
* under the License.
*/
-import org.apache.archiva.admin.repository.RepositoryAdminException;
-import org.apache.archiva.rest.api.model.ManagedRepository;
import org.apache.archiva.rest.api.model.RemoteRepository;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.util.List;
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
List<RemoteRepository> getRemoteRepositories()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "getRemoteRepository/{repositoryId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
RemoteRepository getRemoteRepository( @PathParam( "repositoryId" ) String repositoryId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "deleteRemoteRepository/{repositoryId}" )
@GET
* under the License.
*/
-import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.rest.api.model.RepositoryGroup;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
List<RepositoryGroup> getRepositoriesGroups()
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "getRepositoryGroup/{repositoryGroupId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
RepositoryGroup getRepositoryGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "addRepositoryGroup" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addRepositoryGroup( RepositoryGroup repositoryGroup )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "updateRepositoryGroup" )
@POST
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "deleteRepositoryGroup/{repositoryGroupId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteRepositoryGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "addRepositoryToGroup" )
@GET
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addRepositoryToGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
@QueryParam( "repositoryId" ) String repositoryId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
@Path( "addRepositoryToGroup" )
@GET
@RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteRepositoryFromGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
@QueryParam( "repositoryId" ) String repositoryId )
- throws RepositoryAdminException;
+ throws ArchivaRestServiceException;
}
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.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
private ArchivaAdministration archivaAdministration;
public List<LegacyArtifactPath> getLegacyArtifactPaths()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
- for ( org.apache.archiva.admin.repository.admin.LegacyArtifactPath legacyArtifactPath : archivaAdministration.getLegacyArtifactPaths() )
+ try
{
- legacyArtifactPaths.add(
- new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
+ List<LegacyArtifactPath> legacyArtifactPaths = new ArrayList<LegacyArtifactPath>();
+ for ( org.apache.archiva.admin.repository.admin.LegacyArtifactPath legacyArtifactPath : archivaAdministration.getLegacyArtifactPaths() )
+ {
+ legacyArtifactPaths.add(
+ new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) );
+ }
+ return legacyArtifactPaths;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- return legacyArtifactPaths;
}
public void addLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
- org.apache.archiva.admin.repository.admin.LegacyArtifactPath.class ),
- getAuditInformation() );
+ try
+ {
+ archivaAdministration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath,
+ org.apache.archiva.admin.repository.admin.LegacyArtifactPath.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean deleteLegacyArtifactPath( String path )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.deleteLegacyArtifactPath( path, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.deleteLegacyArtifactPath( path, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public RepositoryScanning getRepositoryScanning()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- return new BeanReplicator().replicateBean( archivaAdministration.getRepositoryScanning(),
- RepositoryScanning.class );
+ try
+ {
+ return new BeanReplicator().replicateBean( archivaAdministration.getRepositoryScanning(),
+ RepositoryScanning.class );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public void updateRepositoryScanning( RepositoryScanning repositoryScanning )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.updateRepositoryScanning( new BeanReplicator().replicateBean( getRepositoryScanning(),
- org.apache.archiva.admin.repository.admin.RepositoryScanning.class ),
- getAuditInformation() );
+ try
+ {
+ archivaAdministration.updateRepositoryScanning( new BeanReplicator().replicateBean( getRepositoryScanning(),
+ org.apache.archiva.admin.repository.admin.RepositoryScanning.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean addFileTypePattern( String fileTypeId, String pattern )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.addFileTypePattern( fileTypeId, pattern, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.addFileTypePattern( fileTypeId, pattern, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean removeFileTypePattern( String fileTypeId, String pattern )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.removeFileTypePattern( fileTypeId, pattern, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.removeFileTypePattern( fileTypeId, pattern, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public FileType getFileType( String fileTypeId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- org.apache.archiva.admin.repository.admin.FileType fileType = archivaAdministration.getFileType( fileTypeId );
- if ( fileType == null )
+ try
+ {
+ org.apache.archiva.admin.repository.admin.FileType fileType =
+ archivaAdministration.getFileType( fileTypeId );
+ if ( fileType == null )
+ {
+ return null;
+ }
+ return new BeanReplicator().replicateBean( fileType, FileType.class );
+ }
+ catch ( RepositoryAdminException e )
{
- return null;
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- return new BeanReplicator().replicateBean( fileType, FileType.class );
}
public void addFileType( FileType fileType )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.addFileType(
- new BeanReplicator().replicateBean( fileType, org.apache.archiva.admin.repository.admin.FileType.class ),
- getAuditInformation() );
-
+ try
+ {
+ archivaAdministration.addFileType( new BeanReplicator().replicateBean( fileType,
+ org.apache.archiva.admin.repository.admin.FileType.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean removeFileType( String fileTypeId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.removeFileType( fileTypeId, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.removeFileType( fileTypeId, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean addKnownContentConsumer( String knownContentConsumer )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.addKnownContentConsumer( knownContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.addKnownContentConsumer( knownContentConsumer, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public void setKnownContentConsumers( List<String> knownContentConsumers )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.setKnownContentConsumers( knownContentConsumers, getAuditInformation() );
+ try
+ {
+ archivaAdministration.setKnownContentConsumers( knownContentConsumers, getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean removeKnownContentConsumer( String knownContentConsumer )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.removeKnownContentConsumer( knownContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.removeKnownContentConsumer( knownContentConsumer, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean addInvalidContentConsumer( String invalidContentConsumer )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.addInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.addInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public void setInvalidContentConsumers( List<String> invalidContentConsumers )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.setInvalidContentConsumers( invalidContentConsumers, getAuditInformation() );
+ try
+ {
+ archivaAdministration.setInvalidContentConsumers( invalidContentConsumers, getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean removeInvalidContentConsumer( String invalidContentConsumer )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- archivaAdministration.removeInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ archivaAdministration.removeInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
}
import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.admin.repository.managed.ManagedRepositoryAdmin;
import org.apache.archiva.rest.api.model.ManagedRepository;
+import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
private ManagedRepositoryAdmin managedRepositoryAdmin;
public List<ManagedRepository> getManagedRepositories()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- List<org.apache.archiva.admin.repository.managed.ManagedRepository> repos =
- managedRepositoryAdmin.getManagedRepositories();
+ try
+ {
+ List<org.apache.archiva.admin.repository.managed.ManagedRepository> repos =
+ managedRepositoryAdmin.getManagedRepositories();
+
+ List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( repos.size() );
- List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( repos.size() );
+ for ( org.apache.archiva.admin.repository.managed.ManagedRepository repoConfig : repos )
+ {
+ // TODO staging repo too
+ ManagedRepository repo =
+ new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
+ repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
+ repoConfig.isBlockRedeployments(), false, repoConfig.getCronExpression() );
+ managedRepos.add( repo );
+ }
- for ( org.apache.archiva.admin.repository.managed.ManagedRepository repoConfig : repos )
+ return managedRepos;
+ }
+ catch ( RepositoryAdminException e )
{
- // TODO staging repo too
- ManagedRepository repo =
- new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
- repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
- repoConfig.isBlockRedeployments(), false, repoConfig.getCronExpression() );
- managedRepos.add( repo );
+ throw new ArchivaRestServiceException( e.getMessage() );
}
-
- return managedRepos;
}
public ManagedRepository getManagedRepository( String repositoryId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
List<ManagedRepository> repos = getManagedRepositories();
for ( ManagedRepository repo : repos )
import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.admin.repository.networkproxy.NetworkProxyAdmin;
import org.apache.archiva.rest.api.model.NetworkProxy;
+import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.NetworkProxyService;
import org.springframework.stereotype.Service;
private NetworkProxyAdmin networkProxyAdmin;
public List<NetworkProxy> getNetworkProxies()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- List<NetworkProxy> networkProxies = new ArrayList<NetworkProxy>();
- for ( org.apache.archiva.admin.repository.networkproxy.NetworkProxy networkProxy : networkProxyAdmin.getNetworkProxies() )
+ try
{
- networkProxies.add( new BeanReplicator().replicateBean( networkProxy, NetworkProxy.class ) );
+ List<NetworkProxy> networkProxies = new ArrayList<NetworkProxy>();
+ for ( org.apache.archiva.admin.repository.networkproxy.NetworkProxy networkProxy : networkProxyAdmin.getNetworkProxies() )
+ {
+ networkProxies.add( new BeanReplicator().replicateBean( networkProxy, NetworkProxy.class ) );
+ }
+ return networkProxies;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- return networkProxies;
}
public NetworkProxy getNetworkProxy( String networkProxyId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- org.apache.archiva.admin.repository.networkproxy.NetworkProxy networkProxy =
- networkProxyAdmin.getNetworkProxy( networkProxyId );
- return networkProxy == null ? null : new BeanReplicator().replicateBean( networkProxy, NetworkProxy.class );
+ try
+ {
+ org.apache.archiva.admin.repository.networkproxy.NetworkProxy networkProxy =
+ networkProxyAdmin.getNetworkProxy( networkProxyId );
+ return networkProxy == null ? null : new BeanReplicator().replicateBean( networkProxy, NetworkProxy.class );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public void addNetworkProxy( NetworkProxy networkProxy )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- if ( networkProxy == null )
+ try
{
- return;
+ if ( networkProxy == null )
+ {
+ return;
+ }
+ getNetworkProxyAdmin().addNetworkProxy( new BeanReplicator().replicateBean( networkProxy,
+ org.apache.archiva.admin.repository.networkproxy.NetworkProxy.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- getNetworkProxyAdmin().addNetworkProxy( new BeanReplicator().replicateBean( networkProxy,
- org.apache.archiva.admin.repository.networkproxy.NetworkProxy.class ),
- getAuditInformation() );
}
public void updateNetworkProxy( NetworkProxy networkProxy )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
if ( networkProxy == null )
{
return;
}
- getNetworkProxyAdmin().updateNetworkProxy( new BeanReplicator().replicateBean( networkProxy,
- org.apache.archiva.admin.repository.networkproxy.NetworkProxy.class ),
- getAuditInformation() );
+ try
+ {
+ getNetworkProxyAdmin().updateNetworkProxy( new BeanReplicator().replicateBean( networkProxy,
+ org.apache.archiva.admin.repository.networkproxy.NetworkProxy.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean deleteNetworkProxy( String networkProxyId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- getNetworkProxyAdmin().deleteNetworkProxy( networkProxyId, getAuditInformation() );
- return Boolean.TRUE;
+ try
+ {
+ getNetworkProxyAdmin().deleteNetworkProxy( networkProxyId, getAuditInformation() );
+ return Boolean.TRUE;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public NetworkProxyAdmin getNetworkProxyAdmin()
import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.admin.repository.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.rest.api.model.ProxyConnector;
+import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ProxyConnectorService;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
/**
* @author Olivier Lamy
private ProxyConnectorAdmin proxyConnectorAdmin;
public List<ProxyConnector> getProxyConnectors()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>();
- for ( org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector : proxyConnectorAdmin.getProxyConnectors() )
+ try
{
- proxyConnectors.add( new BeanReplicator().replicateBean( proxyConnector, ProxyConnector.class ) );
+ List<ProxyConnector> proxyConnectors = new ArrayList<ProxyConnector>();
+ for ( org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector : proxyConnectorAdmin.getProxyConnectors() )
+ {
+ proxyConnectors.add( new BeanReplicator().replicateBean( proxyConnector, ProxyConnector.class ) );
+ }
+ return proxyConnectors;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- return proxyConnectors;
}
public ProxyConnector getProxyConnector( String sourceRepoId, String targetRepoId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector =
- proxyConnectorAdmin.getProxyConnector( sourceRepoId, targetRepoId );
- return proxyConnector == null
- ? null
- : new BeanReplicator().replicateBean( proxyConnector, ProxyConnector.class );
+ try
+ {
+ org.apache.archiva.admin.repository.proxyconnector.ProxyConnector proxyConnector =
+ proxyConnectorAdmin.getProxyConnector( sourceRepoId, targetRepoId );
+ return proxyConnector == null
+ ? null
+ : new BeanReplicator().replicateBean( proxyConnector, ProxyConnector.class );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean addProxyConnector( ProxyConnector proxyConnector )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
return Boolean.FALSE;
}
- return proxyConnectorAdmin.addProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
- org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
- getAuditInformation() );
+ try
+ {
+ return proxyConnectorAdmin.addProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
+ org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean deleteProxyConnector( ProxyConnector proxyConnector )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
return Boolean.FALSE;
}
- return proxyConnectorAdmin.deleteProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
- org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
- getAuditInformation() );
+ try
+ {
+ return proxyConnectorAdmin.deleteProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
+ org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean updateProxyConnector( ProxyConnector proxyConnector )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
return Boolean.FALSE;
}
- return proxyConnectorAdmin.updateProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
- org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
- getAuditInformation() );
+ try
+ {
+ return proxyConnectorAdmin.updateProxyConnector( new BeanReplicator().replicateBean( proxyConnector,
+ org.apache.archiva.admin.repository.proxyconnector.ProxyConnector.class ),
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public ProxyConnectorAdmin getProxyConnectorAdmin()
import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.admin.repository.remote.RemoteRepositoryAdmin;
import org.apache.archiva.rest.api.model.RemoteRepository;
+import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
private RemoteRepositoryAdmin remoteRepositoryAdmin;
public List<RemoteRepository> getRemoteRepositories()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
- for ( org.apache.archiva.admin.repository.remote.RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
+ try
{
- RemoteRepository repo =
- new RemoteRepository( remoteRepository.getId(), remoteRepository.getName(), remoteRepository.getUrl(),
- remoteRepository.getLayout(), remoteRepository.getUserName(),
- remoteRepository.getPassword(), remoteRepository.getTimeout() );
- remoteRepositories.add( repo );
+ List<RemoteRepository> remoteRepositories = new ArrayList<RemoteRepository>();
+ for ( org.apache.archiva.admin.repository.remote.RemoteRepository remoteRepository : remoteRepositoryAdmin.getRemoteRepositories() )
+ {
+ RemoteRepository repo = new RemoteRepository( remoteRepository.getId(), remoteRepository.getName(),
+ remoteRepository.getUrl(), remoteRepository.getLayout(),
+ remoteRepository.getUserName(),
+ remoteRepository.getPassword(),
+ remoteRepository.getTimeout() );
+ remoteRepositories.add( repo );
+ }
+ return remoteRepositories;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- return remoteRepositories;
}
public RemoteRepository getRemoteRepository( String repositoryId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
List<RemoteRepository> remoteRepositories = getRemoteRepositories();
for ( RemoteRepository repository : remoteRepositories )
import org.apache.archiva.admin.repository.RepositoryAdminException;
import org.apache.archiva.admin.repository.group.RepositoryGroupAdmin;
import org.apache.archiva.rest.api.model.RepositoryGroup;
+import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoryGroupService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
private RepositoryGroupAdmin repositoryGroupAdmin;
public List<RepositoryGroup> getRepositoriesGroups()
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- List<RepositoryGroup> repositoriesGroups = new ArrayList<RepositoryGroup>();
- for ( org.apache.archiva.admin.repository.group.RepositoryGroup repoGroup : repositoryGroupAdmin.getRepositoriesGroups() )
+ try
{
- repositoriesGroups.add(
- new RepositoryGroup( repoGroup.getId(), new ArrayList<String>( repoGroup.getRepositories() ) ) );
+ List<RepositoryGroup> repositoriesGroups = new ArrayList<RepositoryGroup>();
+ for ( org.apache.archiva.admin.repository.group.RepositoryGroup repoGroup : repositoryGroupAdmin.getRepositoriesGroups() )
+ {
+ repositoriesGroups.add(
+ new RepositoryGroup( repoGroup.getId(), new ArrayList<String>( repoGroup.getRepositories() ) ) );
+ }
+ return repositoriesGroups;
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
}
- return repositoriesGroups;
}
public RepositoryGroup getRepositoryGroup( String repositoryGroupId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
for ( RepositoryGroup repositoryGroup : getRepositoriesGroups() )
{
}
public Boolean addRepositoryGroup( RepositoryGroup repoGroup )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- return repositoryGroupAdmin.addRepositoryGroup(
- new org.apache.archiva.admin.repository.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
- repoGroup.getRepositories() ) ), getAuditInformation() );
+ try
+ {
+ return repositoryGroupAdmin.addRepositoryGroup(
+ new org.apache.archiva.admin.repository.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
+ repoGroup.getRepositories() ) ), getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean updateRepositoryGroup( RepositoryGroup repoGroup )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- return repositoryGroupAdmin.updateRepositoryGroup(
- new org.apache.archiva.admin.repository.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
- repoGroup.getRepositories() ) ), getAuditInformation() );
+ try
+ {
+ return repositoryGroupAdmin.updateRepositoryGroup(
+ new org.apache.archiva.admin.repository.group.RepositoryGroup( repoGroup.getId(), new ArrayList<String>(
+ repoGroup.getRepositories() ) ), getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean deleteRepositoryGroup( String repositoryGroupId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- return repositoryGroupAdmin.deleteRepositoryGroup( repositoryGroupId, getAuditInformation() );
+ try
+ {
+ return repositoryGroupAdmin.deleteRepositoryGroup( repositoryGroupId, getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- return repositoryGroupAdmin.addRepositoryToGroup( repositoryGroupId, repositoryId, getAuditInformation() );
+ try
+ {
+ return repositoryGroupAdmin.addRepositoryToGroup( repositoryGroupId, repositoryId, getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
public Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId )
- throws RepositoryAdminException
+ throws ArchivaRestServiceException
{
- return repositoryGroupAdmin.deleteRepositoryFromGroup( repositoryGroupId, repositoryId, getAuditInformation() );
+ try
+ {
+ return repositoryGroupAdmin.deleteRepositoryFromGroup( repositoryGroupId, repositoryId,
+ getAuditInformation() );
+ }
+ catch ( RepositoryAdminException e )
+ {
+ throw new ArchivaRestServiceException( e.getMessage() );
+ }
}
}