git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1338243 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M3
@@ -39,26 +39,26 @@ public class ArchivaRestServiceException | |||
private String fieldName; | |||
public ArchivaRestServiceException( String message ) | |||
public ArchivaRestServiceException( String message, Throwable t ) | |||
{ | |||
super( message ); | |||
super( message, t ); | |||
} | |||
public ArchivaRestServiceException( String message, String fieldName ) | |||
public ArchivaRestServiceException( String message, String fieldName, Throwable t ) | |||
{ | |||
this( message ); | |||
this( message, t ); | |||
this.fieldName = fieldName; | |||
} | |||
public ArchivaRestServiceException( String s, int httpErrorCode ) | |||
public ArchivaRestServiceException( String s, int httpErrorCode, Throwable t ) | |||
{ | |||
super( s ); | |||
super( s, t ); | |||
this.httpErrorCode = httpErrorCode; | |||
} | |||
public ArchivaRestServiceException( String s, int httpErrorCode, String fieldName ) | |||
public ArchivaRestServiceException( String s, int httpErrorCode, String fieldName, Throwable t ) | |||
{ | |||
this( s, httpErrorCode ); | |||
this( s, httpErrorCode, t ); | |||
this.fieldName = fieldName; | |||
} | |||
@@ -72,7 +72,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -93,7 +93,7 @@ public class DefaultArchivaAdministrationService | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"artifact path reference '" + legacyArtifactPath.getPath() + "' does not match the initial path: '" | |||
+ path + "'", Response.Status.BAD_REQUEST.getStatusCode() ); | |||
+ path + "'", Response.Status.BAD_REQUEST.getStatusCode(), null ); | |||
} | |||
try | |||
@@ -103,7 +103,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -117,7 +117,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -132,7 +132,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -146,7 +146,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -159,7 +159,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -172,7 +172,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -186,7 +186,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -200,7 +200,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -213,7 +213,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -227,7 +227,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -241,7 +241,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -254,7 +254,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -268,7 +268,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -286,7 +286,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -299,7 +299,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -312,7 +312,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -325,7 +325,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -338,7 +338,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -352,7 +352,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -365,7 +365,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -378,7 +378,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -391,7 +391,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -409,7 +409,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -427,7 +427,7 @@ public class DefaultArchivaAdministrationService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
} |
@@ -115,7 +115,7 @@ public class DefaultBrowseService | |||
catch ( MetadataResolutionException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ | |||
@@ -167,7 +167,7 @@ public class DefaultBrowseService | |||
catch ( MetadataResolutionException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ | |||
@@ -200,7 +200,7 @@ public class DefaultBrowseService | |||
catch ( MetadataResolutionException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
} | |||
@@ -397,7 +397,7 @@ public class DefaultBrowseService | |||
catch ( MetadataResolutionException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ | |||
@@ -423,7 +423,7 @@ public class DefaultBrowseService | |||
catch ( DependencyTreeBuilderException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
return treeEntries; | |||
} | |||
@@ -438,7 +438,7 @@ public class DefaultBrowseService | |||
catch ( ArchivaSecurityException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "repositories.read.observable.error", | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
} | |||
@@ -462,7 +462,7 @@ public class DefaultBrowseService | |||
catch ( MetadataResolutionException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ | |||
@@ -550,7 +550,7 @@ public class DefaultBrowseService | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ | |||
@@ -598,7 +598,7 @@ public class DefaultBrowseService | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ | |||
@@ -634,19 +634,19 @@ public class DefaultBrowseService | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
catch ( RepositoryNotFoundException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
catch ( RepositoryException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
return Collections.emptyList(); | |||
} | |||
@@ -789,19 +789,13 @@ public class DefaultBrowseService | |||
if ( !selectedRepos.contains( repositoryId ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "browse.root.groups.repositoy.denied", | |||
Response.Status.FORBIDDEN.getStatusCode() ); | |||
Response.Status.FORBIDDEN.getStatusCode(), null ); | |||
} | |||
selectedRepos = Collections.singletonList( repositoryId ); | |||
} | |||
return selectedRepos; | |||
} | |||
private List<String> getSortedList( Set<String> set ) | |||
{ | |||
List<String> list = new ArrayList<String>( set ); | |||
Collections.sort( list ); | |||
return list; | |||
} | |||
private String collapseNamespaces( RepositorySession repositorySession, MetadataResolver metadataResolver, | |||
Collection<String> repoIds, String n ) |
@@ -18,13 +18,13 @@ package org.apache.archiva.rest.services; | |||
* under the License. | |||
*/ | |||
import org.apache.archiva.redback.components.scheduler.CronExpressionValidator; | |||
import org.apache.archiva.redback.rest.api.services.RedbackServiceException; | |||
import org.apache.archiva.redback.rest.api.services.UtilServices; | |||
import org.apache.archiva.rest.api.services.ArchivaRestServiceException; | |||
import org.apache.archiva.rest.api.services.CommonServices; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.archiva.redback.components.scheduler.CronExpressionValidator; | |||
import org.apache.archiva.redback.rest.api.services.RedbackServiceException; | |||
import org.apache.archiva.redback.rest.api.services.UtilServices; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.stereotype.Service; | |||
@@ -168,11 +168,11 @@ public class DefaultCommonServices | |||
catch ( IOException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
catch ( RedbackServiceException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getHttpErrorCode() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getHttpErrorCode(), e ); | |||
} | |||
} | |||
@@ -188,7 +188,7 @@ public class DefaultCommonServices | |||
catch ( IOException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
finally | |||
{ |
@@ -72,7 +72,7 @@ public class DefaultManagedRepositoriesService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -102,7 +102,7 @@ public class DefaultManagedRepositoriesService | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); | |||
} | |||
} | |||
@@ -119,11 +119,11 @@ public class DefaultManagedRepositoriesService | |||
{ | |||
return getManagedRepository( managedRepository.getId() ); | |||
} | |||
throw new ArchivaRestServiceException( "fail to created managed Repository" ); | |||
throw new ArchivaRestServiceException( "fail to created managed Repository", null ); | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); | |||
} | |||
} | |||
@@ -141,7 +141,7 @@ public class DefaultManagedRepositoriesService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e.getFieldName(), e ); | |||
} | |||
} | |||
@@ -50,7 +50,7 @@ public class DefaultNetworkProxyService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -63,7 +63,7 @@ public class DefaultNetworkProxyService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -80,7 +80,7 @@ public class DefaultNetworkProxyService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -97,7 +97,7 @@ public class DefaultNetworkProxyService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -111,7 +111,7 @@ public class DefaultNetworkProxyService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -62,7 +62,7 @@ public class DefaultProxyConnectorService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -75,7 +75,7 @@ public class DefaultProxyConnectorService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -92,7 +92,7 @@ public class DefaultProxyConnectorService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -109,7 +109,7 @@ public class DefaultProxyConnectorService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -121,7 +121,7 @@ public class DefaultProxyConnectorService | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"proxyConnector with sourceRepoId:" + sourceRepoId + " and targetRepoId:" + targetRepoId | |||
+ " not exists" ); | |||
+ " not exists", null ); | |||
} | |||
return deleteProxyConnector( proxyConnector ); | |||
} | |||
@@ -139,7 +139,7 @@ public class DefaultProxyConnectorService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -53,7 +53,7 @@ public class DefaultRemoteRepositoriesService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -40,6 +40,12 @@ import org.apache.archiva.metadata.repository.RepositorySessionFactory; | |||
import org.apache.archiva.model.ArchivaRepositoryMetadata; | |||
import org.apache.archiva.model.ArtifactReference; | |||
import org.apache.archiva.model.VersionedReference; | |||
import org.apache.archiva.redback.authentication.AuthenticationResult; | |||
import org.apache.archiva.redback.authorization.AuthorizationException; | |||
import org.apache.archiva.redback.components.taskqueue.TaskQueueException; | |||
import org.apache.archiva.redback.system.DefaultSecuritySession; | |||
import org.apache.archiva.redback.system.SecuritySession; | |||
import org.apache.archiva.redback.system.SecuritySystem; | |||
import org.apache.archiva.redback.users.User; | |||
import org.apache.archiva.redback.users.UserNotFoundException; | |||
import org.apache.archiva.repository.ContentNotFoundException; | |||
@@ -72,12 +78,6 @@ import org.apache.commons.io.FilenameUtils; | |||
import org.apache.commons.io.IOUtils; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.maven.index.context.IndexingContext; | |||
import org.apache.archiva.redback.authentication.AuthenticationResult; | |||
import org.apache.archiva.redback.authorization.AuthorizationException; | |||
import org.apache.archiva.redback.system.DefaultSecuritySession; | |||
import org.apache.archiva.redback.system.SecuritySession; | |||
import org.apache.archiva.redback.system.SecuritySystem; | |||
import org.apache.archiva.redback.components.taskqueue.TaskQueueException; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import org.springframework.stereotype.Service; | |||
@@ -219,7 +219,7 @@ public class DefaultRepositoriesService | |||
catch ( Exception e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -233,7 +233,7 @@ public class DefaultRepositoriesService | |||
catch ( DownloadRemoteIndexException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
return Boolean.TRUE; | |||
} | |||
@@ -245,17 +245,17 @@ public class DefaultRepositoriesService | |||
String userName = getAuditInformation().getUser().getUsername(); | |||
if ( StringUtils.isBlank( userName ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "copyArtifact call: userName not found" ); | |||
throw new ArchivaRestServiceException( "copyArtifact call: userName not found", null ); | |||
} | |||
if ( StringUtils.isBlank( artifactTransferRequest.getRepositoryId() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "copyArtifact call: sourceRepositoryId cannot be null" ); | |||
throw new ArchivaRestServiceException( "copyArtifact call: sourceRepositoryId cannot be null", null ); | |||
} | |||
if ( StringUtils.isBlank( artifactTransferRequest.getTargetRepositoryId() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "copyArtifact call: targetRepositoryId cannot be null" ); | |||
throw new ArchivaRestServiceException( "copyArtifact call: targetRepositoryId cannot be null", null ); | |||
} | |||
ManagedRepository source = null; | |||
@@ -265,13 +265,13 @@ public class DefaultRepositoriesService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
if ( source == null ) | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"cannot find repository with id " + artifactTransferRequest.getRepositoryId() ); | |||
"cannot find repository with id " + artifactTransferRequest.getRepositoryId(), null ); | |||
} | |||
ManagedRepository target = null; | |||
@@ -281,33 +281,33 @@ public class DefaultRepositoriesService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
if ( target == null ) | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"cannot find repository with id " + artifactTransferRequest.getTargetRepositoryId() ); | |||
"cannot find repository with id " + artifactTransferRequest.getTargetRepositoryId(), null ); | |||
} | |||
if ( StringUtils.isBlank( artifactTransferRequest.getGroupId() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "groupId is mandatory" ); | |||
throw new ArchivaRestServiceException( "groupId is mandatory", null ); | |||
} | |||
if ( StringUtils.isBlank( artifactTransferRequest.getArtifactId() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "artifactId is mandatory" ); | |||
throw new ArchivaRestServiceException( "artifactId is mandatory", null ); | |||
} | |||
if ( StringUtils.isBlank( artifactTransferRequest.getVersion() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "version is mandatory" ); | |||
throw new ArchivaRestServiceException( "version is mandatory", null ); | |||
} | |||
if ( VersionUtil.isSnapshot( artifactTransferRequest.getVersion() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "copy of SNAPSHOT not supported" ); | |||
throw new ArchivaRestServiceException( "copy of SNAPSHOT not supported", null ); | |||
} | |||
// end check parameters | |||
@@ -319,7 +319,7 @@ public class DefaultRepositoriesService | |||
} | |||
catch ( UserNotFoundException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "user " + userName + " not found" ); | |||
throw new ArchivaRestServiceException( "user " + userName + " not found", null ); | |||
} | |||
// check karma on source : read | |||
@@ -333,13 +333,13 @@ public class DefaultRepositoriesService | |||
if ( !authz ) | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"not authorized to access repo:" + artifactTransferRequest.getRepositoryId() ); | |||
"not authorized to access repo:" + artifactTransferRequest.getRepositoryId(), null ); | |||
} | |||
} | |||
catch ( AuthorizationException e ) | |||
{ | |||
log.error( "error reading permission: " + e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
// check karma on target: write | |||
@@ -351,13 +351,13 @@ public class DefaultRepositoriesService | |||
if ( !authz ) | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"not authorized to write to repo:" + artifactTransferRequest.getTargetRepositoryId() ); | |||
"not authorized to write to repo:" + artifactTransferRequest.getTargetRepositoryId(), null ); | |||
} | |||
} | |||
catch ( AuthorizationException e ) | |||
{ | |||
log.error( "error reading permission: " + e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
// sounds good we can continue ! | |||
@@ -381,7 +381,8 @@ public class DefaultRepositoriesService | |||
if ( StringUtils.isEmpty( artifactSourcePath ) ) | |||
{ | |||
log.error( "cannot find artifact " + artifactTransferRequest.toString() ); | |||
throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString() ); | |||
throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString(), | |||
null ); | |||
} | |||
File artifactFile = new File( source.getLocation(), artifactSourcePath ); | |||
@@ -389,7 +390,8 @@ public class DefaultRepositoriesService | |||
if ( !artifactFile.exists() ) | |||
{ | |||
log.error( "cannot find artifact " + artifactTransferRequest.toString() ); | |||
throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString() ); | |||
throw new ArchivaRestServiceException( "cannot find artifact " + artifactTransferRequest.toString(), | |||
null ); | |||
} | |||
ManagedRepositoryContent targetRepository = | |||
@@ -426,7 +428,7 @@ public class DefaultRepositoriesService | |||
{ | |||
throw new ArchivaRestServiceException( | |||
"artifact already exists in target repo: " + artifactTransferRequest.getTargetRepositoryId() | |||
+ " and redeployment blocked" ); | |||
+ " and redeployment blocked", null ); | |||
} | |||
else | |||
{ | |||
@@ -472,17 +474,17 @@ public class DefaultRepositoriesService | |||
catch ( RepositoryException e ) | |||
{ | |||
log.error( "RepositoryException: " + e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
log.error( "RepositoryAdminException: " + e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
catch ( IOException e ) | |||
{ | |||
log.error( "IOException: " + e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
return true; | |||
} | |||
@@ -627,27 +629,27 @@ public class DefaultRepositoriesService | |||
if ( StringUtils.isEmpty( repositoryId ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400 ); | |||
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null ); | |||
} | |||
if ( !isAuthorizedToDeleteArtifacts( repositoryId ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403 ); | |||
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null ); | |||
} | |||
if ( artifact == null ) | |||
{ | |||
throw new ArchivaRestServiceException( "artifact cannot be null", 400 ); | |||
throw new ArchivaRestServiceException( "artifact cannot be null", 400, null ); | |||
} | |||
if ( StringUtils.isEmpty( artifact.getGroupId() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "artifact.groupId cannot be null", 400 ); | |||
throw new ArchivaRestServiceException( "artifact.groupId cannot be null", 400, null ); | |||
} | |||
if ( StringUtils.isEmpty( artifact.getArtifactId() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "artifact.artifactId cannot be null", 400 ); | |||
throw new ArchivaRestServiceException( "artifact.artifactId cannot be null", 400, null ); | |||
} | |||
// TODO more control on artifact fields | |||
@@ -674,7 +676,7 @@ public class DefaultRepositoriesService | |||
if ( StringUtils.isBlank( artifact.getPackaging() ) ) | |||
{ | |||
throw new ArchivaRestServiceException( "You must configure a type/packaging when using classifier", | |||
400 ); | |||
400, null ); | |||
} | |||
ArtifactReference artifactReference = new ArtifactReference(); | |||
artifactReference.setArtifactId( artifact.getArtifactId() ); | |||
@@ -740,27 +742,27 @@ public class DefaultRepositoriesService | |||
catch ( ContentNotFoundException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "Artifact does not exist: " + e.getMessage(), 400 ); | |||
throw new ArchivaRestServiceException( "Artifact does not exist: " + e.getMessage(), 400, e ); | |||
} | |||
catch ( RepositoryNotFoundException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "Target repository cannot be found: " + e.getMessage(), 400 ); | |||
throw new ArchivaRestServiceException( "Target repository cannot be found: " + e.getMessage(), 400, e ); | |||
} | |||
catch ( RepositoryException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500 ); | |||
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e ); | |||
} | |||
catch ( MetadataResolutionException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500 ); | |||
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e ); | |||
} | |||
catch ( MetadataRepositoryException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500 ); | |||
throw new ArchivaRestServiceException( "Repository exception: " + e.getMessage(), 500, e ); | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( "RepositoryAdmin exception: " + e.getMessage(), 500 ); | |||
throw new ArchivaRestServiceException( "RepositoryAdmin exception: " + e.getMessage(), 500, e ); | |||
} | |||
finally | |||
@@ -784,7 +786,7 @@ public class DefaultRepositoriesService | |||
catch ( ArchivaSecurityException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
} | |||
@@ -799,12 +801,12 @@ public class DefaultRepositoriesService | |||
catch ( RepositoryScannerException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500 ); | |||
throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500, e ); | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500 ); | |||
throw new ArchivaRestServiceException( "RepositoryScannerException exception: " + e.getMessage(), 500, e ); | |||
} | |||
} | |||
@@ -58,7 +58,7 @@ public class DefaultRepositoryGroupService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -86,7 +86,7 @@ public class DefaultRepositoryGroupService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -101,7 +101,7 @@ public class DefaultRepositoryGroupService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -114,7 +114,7 @@ public class DefaultRepositoryGroupService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -127,7 +127,7 @@ public class DefaultRepositoryGroupService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -141,7 +141,7 @@ public class DefaultRepositoryGroupService | |||
} | |||
catch ( RepositoryAdminException e ) | |||
{ | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
} |
@@ -74,7 +74,7 @@ public class DefaultSearchService | |||
catch ( RepositorySearchException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -102,7 +102,7 @@ public class DefaultSearchService | |||
catch ( RepositorySearchException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -127,7 +127,7 @@ public class DefaultSearchService | |||
catch ( RepositorySearchException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -155,7 +155,7 @@ public class DefaultSearchService | |||
catch ( RepositorySearchException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} | |||
@@ -175,7 +175,7 @@ public class DefaultSearchService | |||
catch ( RepositorySearchException e ) | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage() ); | |||
throw new ArchivaRestServiceException( e.getMessage(), e ); | |||
} | |||
} |
@@ -19,6 +19,9 @@ package org.apache.archiva.rest.services; | |||
*/ | |||
import org.apache.archiva.redback.components.cache.Cache; | |||
import org.apache.archiva.redback.components.cache.CacheStatistics; | |||
import org.apache.archiva.redback.components.taskqueue.TaskQueue; | |||
import org.apache.archiva.redback.components.taskqueue.TaskQueueException; | |||
import org.apache.archiva.repository.scanner.RepositoryScanner; | |||
import org.apache.archiva.repository.scanner.RepositoryScannerInstance; | |||
import org.apache.archiva.rest.api.model.CacheEntry; | |||
@@ -28,9 +31,6 @@ import org.apache.archiva.rest.api.model.RepositoryScannerStatistics; | |||
import org.apache.archiva.rest.api.services.ArchivaRestServiceException; | |||
import org.apache.archiva.rest.api.services.SystemStatusService; | |||
import org.apache.archiva.rest.services.utils.ConsumerScanningStatisticsComparator; | |||
import org.apache.archiva.redback.components.cache.CacheStatistics; | |||
import org.apache.archiva.redback.components.taskqueue.TaskQueue; | |||
import org.apache.archiva.redback.components.taskqueue.TaskQueueException; | |||
import org.springframework.context.ApplicationContext; | |||
import org.springframework.stereotype.Service; | |||
@@ -114,7 +114,7 @@ public class DefaultSystemStatusService | |||
{ | |||
log.error( e.getMessage(), e ); | |||
throw new ArchivaRestServiceException( e.getMessage(), | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode() ); | |||
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e ); | |||
} | |||
} | |||
@@ -142,7 +142,7 @@ public class DefaultSystemStatusService | |||
if ( cache == null ) | |||
{ | |||
throw new ArchivaRestServiceException( "no cache for key: " + cacheKey, | |||
Response.Status.BAD_REQUEST.getStatusCode() ); | |||
Response.Status.BAD_REQUEST.getStatusCode(), null ); | |||
} | |||
cache.clear(); |