]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1490] REST services : fix bad design as rest-api introduced a dependency on...
authorOlivier Lamy <olamy@apache.org>
Fri, 9 Sep 2011 14:39:19 +0000 (14:39 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 9 Sep 2011 14:39:19 +0000 (14:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1167220 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/pom.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/RepositoryScanning.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ArchivaAdministrationService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/NetworkProxyService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/ProxyConnectorService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RemoteRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/RepositoryGroupService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultManagedRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultNetworkProxyService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultProxyConnectorService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRemoteRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoryGroupService.java

index aaf0e26c37eff7674200ab6d9a19c8cd967259f1..005a95101feed3612b1ec822d9bdb5ec44ce29f0 100644 (file)
       <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>
index 2810e206516d952953ceef59b2b80aae7b34cf8f..870b9c3ed4e50a319d3f62da7663c22b370f0762 100644 (file)
@@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.model;
  * under the License.
  */
 
-import org.apache.archiva.admin.repository.admin.FileType;
 
 import javax.xml.bind.annotation.XmlRootElement;
 import java.io.Serializable;
@@ -52,8 +51,8 @@ public class RepositoryScanning
         // 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;
index 1148b5e3d8b82a7783c9559b188d9948c9748b23..6f24e382d5a7e3818436317aa5b6ad56172b2e58 100644 (file)
@@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.services;
  * 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;
@@ -46,7 +45,7 @@ public interface ArchivaAdministrationService
     @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
@@ -54,35 +53,35 @@ public interface ArchivaAdministrationService
     @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
@@ -90,42 +89,42 @@ public interface ArchivaAdministrationService
     @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" )
@@ -133,26 +132,26 @@ public interface ArchivaAdministrationService
     @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;
 }
index c224c6bd06f480f866c7809134fab6d7ed4f1b5f..af59a972f88ebecfd710c569163027ff5bb8f5ae 100644 (file)
@@ -19,7 +19,6 @@ package org.apache.archiva.rest.api.services;
  * 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;
@@ -46,14 +45,14 @@ public interface ManagedRepositoriesService
     @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
index d1850e21220f20207e066ca026be62f316b54f47..7913cbaf4f1baeb204b27ffc1c9161cc3edcfe5f 100644 (file)
@@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.services;
  * 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;
@@ -44,14 +43,14 @@ public interface NetworkProxyService
     @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
@@ -59,7 +58,7 @@ public interface NetworkProxyService
     @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
@@ -67,12 +66,12 @@ public interface NetworkProxyService
     @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;
 }
index be3a168fd19bcaae01a387934a0affcbb364db32..e55232ec8be78d7b2b0fd53ebcf461e35873d6c4 100644 (file)
@@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.services;
  * 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;
@@ -46,7 +45,7 @@ public interface ProxyConnectorService
     @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
@@ -54,7 +53,7 @@ public interface ProxyConnectorService
     @RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
     ProxyConnector getProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId,
                                       @QueryParam( "targetRepoId" ) String targetRepoId )
-        throws RepositoryAdminException;
+        throws ArchivaRestServiceException;
 
     @Path( "addProxyConnector" )
     @POST
@@ -62,7 +61,7 @@ public interface ProxyConnectorService
     @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
@@ -70,14 +69,13 @@ public interface ProxyConnectorService
     @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" )
@@ -86,7 +84,7 @@ public interface ProxyConnectorService
     @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
     @RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
     Boolean updateProxyConnector( ProxyConnector proxyConnector )
-        throws RepositoryAdminException;
+        throws ArchivaRestServiceException;
 
 
 }
index 20a4b8b37b5048b42b50d9fb9c5026fc20b7b06a..d5e85eeba03d55beb7487f81335f8a21b747f2bd 100644 (file)
@@ -19,8 +19,6 @@ package org.apache.archiva.rest.api.services;
  * 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;
@@ -31,7 +29,6 @@ import javax.ws.rs.POST;
 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;
 
@@ -47,14 +44,14 @@ public interface RemoteRepositoriesService
     @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
index fd26e24df3dabfe17077db1c19f84d5cf5dd8feb..4c20da16df83e72d3d4c361926efa63f35f9a254 100644 (file)
@@ -18,7 +18,6 @@ package org.apache.archiva.rest.api.services;
  * 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;
@@ -45,14 +44,14 @@ public interface RepositoryGroupService
     @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
@@ -60,7 +59,7 @@ public interface RepositoryGroupService
     @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
@@ -68,14 +67,14 @@ public interface RepositoryGroupService
     @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
@@ -83,7 +82,7 @@ public interface RepositoryGroupService
     @RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
     Boolean addRepositoryToGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
                                   @QueryParam( "repositoryId" ) String repositoryId )
-        throws RepositoryAdminException;
+        throws ArchivaRestServiceException;
 
     @Path( "addRepositoryToGroup" )
     @GET
@@ -91,7 +90,7 @@ public interface RepositoryGroupService
     @RedbackAuthorization( permission = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
     Boolean deleteRepositoryFromGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
                                        @QueryParam( "repositoryId" ) String repositoryId )
-        throws RepositoryAdminException;
+        throws ArchivaRestServiceException;
 
 
 }
index c4b22be36bec342f85235ca036d8753c834f094b..880e2d918db64fa904ec487124ae93eb6022fc59 100644 (file)
@@ -25,6 +25,7 @@ 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.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
@@ -44,125 +45,237 @@ public class DefaultArchivaAdministrationService
     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() );
+        }
     }
 }
index a275f0d4ff3f3752831c58654134e8d097aaf87c..f473abc5829f1e932d038d766c4ad38d0ed43f34 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
 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;
@@ -43,28 +44,35 @@ public class DefaultManagedRepositoriesService
     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 )
index cf046febbe50d2940530885d47f2bb9da2254a8c..5e23c9ff0ea6b8df1e600404154b0d020141c4b6 100644 (file)
@@ -22,6 +22,7 @@ import net.sf.beanlib.provider.replicator.BeanReplicator;
 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;
 
@@ -41,53 +42,88 @@ public class DefaultNetworkProxyService
     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()
index 50cd6b6471f06b8fb618d37553786c20fda1b2ab..24087aa067606831f124e05b62c8cfa4d4762145 100644 (file)
@@ -22,15 +22,13 @@ import net.sf.beanlib.provider.replicator.BeanReplicator;
 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
@@ -44,60 +42,95 @@ public class DefaultProxyConnectorService
     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()
index bd808a2e3f28dd46078cc8f14c2a07e4443bd3e5..9f3eeeb8d7d7cd099f3dd8bf20ebabc0fe454d17 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
 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;
@@ -43,22 +44,30 @@ public class DefaultRemoteRepositoriesService
     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 )
index 500623995b4a5c544ebd5dc44e5ffa8879293588..e68bdd1a84df6feceb6793b0382620c8128fc8bc 100644 (file)
@@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
 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;
@@ -42,19 +43,26 @@ public class DefaultRepositoryGroupService
     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() )
         {
@@ -67,36 +75,72 @@ public class DefaultRepositoryGroupService
     }
 
     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() );
+        }
     }
 }