Adapting to new cxf version. Using result objects instead of simple types in REST services.

This commit is contained in:
Martin Stockhammer 2020-06-30 08:05:07 +02:00
parent 827bd5d95e
commit b9316745df
48 changed files with 625 additions and 263 deletions

View File

@ -0,0 +1,55 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.swing.*;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Simple result for actions that are triggered by the web service.
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement(name = "actionStatus")
public class ActionStatus
{
private boolean success = false;
public static final ActionStatus SUCCESS = new ActionStatus( true );
public static final ActionStatus FAIL = new ActionStatus( false );
public ActionStatus() {
}
public ActionStatus( boolean success) {
this.success = success;
}
public boolean isSuccess( )
{
return success;
}
public void setSuccess( boolean success )
{
this.success = success;
}
}

View File

@ -0,0 +1,51 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* The availability status of some service.
*
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement(name = "availabilityStatus")
public class AvailabilityStatus
{
boolean available = false;
public AvailabilityStatus() {
}
public AvailabilityStatus( boolean available) {
this.available = available;
}
public boolean isAvailable( )
{
return available;
}
public void setAvailable( boolean available )
{
this.available = available;
}
}

View File

@ -0,0 +1,50 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* Status result of a given file
*
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement(name = "fileStatus")
public class FileStatus
{
boolean exists = false;
public FileStatus() {
}
public FileStatus(boolean exists) {
this.exists = exists;
}
public boolean isExists( )
{
return exists;
}
public void setExists( boolean exists )
{
this.exists = exists;
}
}

View File

@ -0,0 +1,51 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* Current permission status for some object
*
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement(name = "permissionStatus")
public class PermissionStatus
{
boolean authorizedToDeleteArtifacts = false;
PermissionStatus() {
}
public PermissionStatus( boolean authorizedToDeleteArtifacts )
{
this.authorizedToDeleteArtifacts = authorizedToDeleteArtifacts;
}
public boolean isAuthorizedToDeleteArtifacts( )
{
return authorizedToDeleteArtifacts;
}
public void setAuthorizedToDeleteArtifacts( boolean authorizedToDeleteArtifacts )
{
this.authorizedToDeleteArtifacts = authorizedToDeleteArtifacts;
}
}

View File

@ -0,0 +1,52 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* The current status of repository scanning
*
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement(name = "scanStatus")
public class ScanStatus
{
boolean isAlreadyScanning = false;
public ScanStatus() {
}
public ScanStatus( boolean isAlreadyScanning )
{
this.isAlreadyScanning = isAlreadyScanning;
}
public boolean isAlreadyScanning( )
{
return isAlreadyScanning;
}
public void setAlreadyScanning( boolean alreadyScanning )
{
isAlreadyScanning = alreadyScanning;
}
}

View File

@ -0,0 +1,51 @@
package org.apache.archiva.rest.api.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.annotation.XmlRootElement;
/**
* Returns true, if a test is valid.
*
* @author Martin Stockhammer <martin_s@apache.org>
*/
@XmlRootElement(name="validationStatus")
public class ValidationStatus
{
boolean valid;
public ValidationStatus() {
}
public ValidationStatus( boolean valid )
{
this.valid = valid;
}
public boolean isValid( )
{
return valid;
}
public void setValid( boolean valid )
{
this.valid = valid;
}
}

View File

@ -27,6 +27,7 @@ import org.apache.archiva.admin.model.beans.NetworkConfiguration;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.admin.model.beans.UiConfiguration;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.archiva.security.common.ArchivaRoleConstants;
@ -59,22 +60,22 @@ public interface ArchivaAdministrationService
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
ActionStatus deleteLegacyArtifactPath( @QueryParam( "path" ) String path )
throws ArchivaRestServiceException;
@Path( "addFileTypePattern" )
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern )
ActionStatus addFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId, @QueryParam( "pattern" ) String pattern )
throws ArchivaRestServiceException;
@Path( "removeFileTypePattern" )
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
@QueryParam( "pattern" ) String pattern )
ActionStatus removeFileTypePattern( @QueryParam( "fileTypeId" ) String fileTypeId,
@QueryParam( "pattern" ) String pattern )
throws ArchivaRestServiceException;
@Path( "getFileType" )
@ -103,14 +104,14 @@ public interface ArchivaAdministrationService
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
ActionStatus removeFileType( @QueryParam( "fileTypeId" ) String fileTypeId )
throws ArchivaRestServiceException;
@Path( "enabledKnownContentConsumer/{knownContentConsumer}" )
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean enabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
ActionStatus enabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
throws ArchivaRestServiceException;
@Path( "enabledKnownContentConsumers" )
@ -125,14 +126,14 @@ public interface ArchivaAdministrationService
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean disabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
ActionStatus disabledKnownContentConsumer( @PathParam( "knownContentConsumer" ) String knownContentConsumer )
throws ArchivaRestServiceException;
@Path( "enabledInvalidContentConsumer/{invalidContentConsumer}" )
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean enabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
ActionStatus enabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
throws ArchivaRestServiceException;
@Path( "enabledInvalidContentConsumers" )
@ -146,7 +147,7 @@ public interface ArchivaAdministrationService
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN} )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean disabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
ActionStatus disabledInvalidContentConsumer( @PathParam( "invalidContentConsumer" ) String invalidContentConsumer )
throws ArchivaRestServiceException;
@Path( "getFileTypes" )
@ -211,13 +212,6 @@ public interface ArchivaAdministrationService
UiConfiguration getUiConfiguration( )
throws ArchivaRestServiceException;
@Path( "registrationDisabled" )
@GET
@Produces( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )
@RedbackAuthorization( noRestriction = true, noPermission = true )
Boolean registrationDisabled( )
throws ArchivaRestServiceException;
@Path( "setUiConfiguration" )
@POST
@Consumes( {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML} )

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@ -50,6 +51,6 @@ public interface ArchivaRuntimeConfigurationService
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
ActionStatus updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
throws ArchivaRestServiceException;
}

View File

@ -24,8 +24,10 @@ import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArtifactContent;
import org.apache.archiva.rest.api.model.ArtifactContentEntry;
import org.apache.archiva.rest.api.model.AvailabilityStatus;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.Entry;
import org.apache.archiva.rest.api.model.MetadataAddRequest;
@ -148,24 +150,24 @@ public interface BrowseService
@PUT
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
Boolean addMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
@PathParam("v") String version, @PathParam("key") String key, @PathParam("value") String value,
@QueryParam("repositoryId") String repositoryId )
ActionStatus addMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
@PathParam("v") String version, @PathParam("key") String key, @PathParam("value") String value,
@QueryParam("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
@Path("metadata/{g}/{a}/{v}/{key}")
@DELETE
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
Boolean deleteMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
@PathParam("v") String version, @PathParam("key") String key,
@QueryParam("repositoryId") String repositoryId )
ActionStatus deleteMetadata( @PathParam("g") String groupId, @PathParam("a") String artifactId,
@PathParam("v") String version, @PathParam("key") String key,
@QueryParam("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
@Path("importMetadata")
@POST
@RedbackAuthorization(noPermission = false, noRestriction = false, permissions = "archiva-add-metadata")
Boolean importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
ActionStatus importMetadata( MetadataAddRequest metadataAddRequest, @QueryParam("repository") String repository )
throws ArchivaRestServiceException;
@Path("artifactContentEntries/{g}/{a}/{v}")
@ -211,8 +213,8 @@ public interface BrowseService
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization(noPermission = true, noRestriction = true)
Boolean artifactAvailable( @PathParam("g") String groupId, @PathParam("a") String artifactId,
@PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
AvailabilityStatus artifactAvailable( @PathParam("g") String groupId, @PathParam("a") String artifactId,
@PathParam("v") String version, @QueryParam("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
/**
@ -224,9 +226,9 @@ public interface BrowseService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noPermission = true, noRestriction = true )
Boolean artifactAvailable( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @PathParam( "c" ) String classifier,
@QueryParam( "repositoryId" ) String repositoryId )
AvailabilityStatus artifactAvailable( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId,
@PathParam( "v" ) String version, @PathParam( "c" ) String classifier,
@QueryParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
/**

View File

@ -20,6 +20,8 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ValidationStatus;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@ -68,7 +70,7 @@ public interface CommonServices
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( noRestriction = true )
Boolean validateCronExpression( @QueryParam( "cronExpression" ) String cronExpression )
ValidationStatus validateCronExpression( @QueryParam( "cronExpression" ) String cronExpression )
throws ArchivaRestServiceException;
}

View File

@ -23,7 +23,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArchivaRepositoryStatistics;
import org.apache.archiva.rest.api.model.FileStatus;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@ -65,8 +67,8 @@ public interface ManagedRepositoriesService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteManagedRepository( @QueryParam( "repositoryId" ) String repositoryId,
@QueryParam( "deleteContent" ) boolean deleteContent )
ActionStatus deleteManagedRepository( @QueryParam( "repositoryId" ) String repositoryId,
@QueryParam( "deleteContent" ) boolean deleteContent )
throws ArchivaRestServiceException;
@ -84,17 +86,17 @@ public interface ManagedRepositoriesService
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateManagedRepository( ManagedRepository managedRepository )
ActionStatus updateManagedRepository( ManagedRepository managedRepository )
throws ArchivaRestServiceException;
/**
* @since 1.4-M3
* @since 3.0
*/
@Path( "fileLocationExists" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean fileLocationExists( @QueryParam( "fileLocation" ) String fileLocation )
FileStatus getFileStatus( @QueryParam( "fileLocation" ) String fileLocation )
throws ArchivaRestServiceException;
/**

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.admin.model.beans.NetworkProxy;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@ -74,6 +75,6 @@ public interface NetworkProxyService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteNetworkProxy( @PathParam( "networkProxyId" ) String networkProxyId )
ActionStatus deleteNetworkProxy( @PathParam( "networkProxyId" ) String networkProxyId )
throws ArchivaRestServiceException;
}

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.admin.model.beans.ProxyConnectorRule;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@ -53,7 +54,7 @@ public interface ProxyConnectorRuleService
@Consumes ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
ActionStatus addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException;
@Path ( "deleteProxyConnectorRule" )
@ -61,7 +62,7 @@ public interface ProxyConnectorRuleService
@Consumes ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
ActionStatus deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException;
/**
@ -72,6 +73,6 @@ public interface ProxyConnectorRuleService
@Consumes ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces ( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization ( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
ActionStatus updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException;
}

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.admin.model.beans.ProxyConnector;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.PolicyInformation;
import org.apache.archiva.security.common.ArchivaRoleConstants;
@ -63,7 +64,7 @@ public interface ProxyConnectorService
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addProxyConnector( ProxyConnector proxyConnector )
ActionStatus addProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException;
@Path( "deleteProxyConnector" )
@ -71,7 +72,7 @@ public interface ProxyConnectorService
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteProxyConnector( ProxyConnector proxyConnector )
ActionStatus deleteProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException;
/**
@ -81,7 +82,7 @@ public interface ProxyConnectorService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean removeProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId,
ActionStatus removeProxyConnector( @QueryParam( "sourceRepoId" ) String sourceRepoId,
@QueryParam( "targetRepoId" ) String targetRepoId )
throws ArchivaRestServiceException;
@ -96,7 +97,7 @@ public interface ProxyConnectorService
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateProxyConnector( ProxyConnector proxyConnector )
ActionStatus updateProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException;
@Path( "allPolicies" )

View File

@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.admin.model.beans.LdapConfiguration;
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
import org.apache.archiva.rest.api.model.RedbackImplementationsInformations;
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
@ -56,7 +57,7 @@ public interface RedbackRuntimeConfigurationService
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
ActionStatus updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
throws ArchivaRestServiceException;
@Path("userManagerImplementationInformations")
@ -85,7 +86,7 @@ public interface RedbackRuntimeConfigurationService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean checkLdapConnection()
ActionStatus checkLdapConnection()
throws ArchivaRestServiceException;
@Path("checkLdapConnection")
@ -93,6 +94,6 @@ public interface RedbackRuntimeConfigurationService
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean checkLdapConnection( LdapConfiguration ldapConfiguration )
ActionStatus checkLdapConnection( LdapConfiguration ldapConfiguration )
throws ArchivaRestServiceException;
}

View File

@ -23,6 +23,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@ -63,7 +64,7 @@ public interface RemoteRepositoriesService
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean deleteRemoteRepository( @PathParam("repositoryId") String repositoryId )
ActionStatus deleteRemoteRepository( @PathParam("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
@ -72,7 +73,7 @@ public interface RemoteRepositoriesService
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean addRemoteRepository( RemoteRepository remoteRepository )
ActionStatus addRemoteRepository( RemoteRepository remoteRepository )
throws ArchivaRestServiceException;
@ -81,13 +82,13 @@ public interface RemoteRepositoriesService
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean updateRemoteRepository( RemoteRepository remoteRepository )
ActionStatus updateRemoteRepository( RemoteRepository remoteRepository )
throws ArchivaRestServiceException;
@Path("checkRemoteConnectivity/{repositoryId}")
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean checkRemoteConnectivity( @PathParam( "repositoryId" ) String repositoryId )
ActionStatus checkRemoteConnectivity( @PathParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
}

View File

@ -23,7 +23,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
import org.apache.archiva.rest.api.model.PermissionStatus;
import org.apache.archiva.rest.api.model.ScanStatus;
import org.apache.archiva.rest.api.model.StringList;
import org.apache.archiva.security.common.ArchivaRoleConstants;
@ -53,8 +56,8 @@ public interface RepositoriesService
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
Boolean scanRepository( @QueryParam ("repositoryId") String repositoryId,
@QueryParam ("fullScan") boolean fullScan )
ActionStatus scanRepository( @QueryParam ("repositoryId") String repositoryId,
@QueryParam ("fullScan") boolean fullScan )
throws ArchivaRestServiceException;
@ -70,25 +73,32 @@ public interface RepositoriesService
throws ArchivaRestServiceException;
/**
* Returns the scan status of the given repository
* @param repositoryId the repository identifier
* @return the status
* @throws ArchivaRestServiceException
* @since 3.0
*/
@Path ("alreadyScanning/{repositoryId}")
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
Boolean alreadyScanning( @PathParam ("repositoryId") String repositoryId )
ScanStatus getScanStatus( @PathParam ("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
@Path ("removeScanningTaskFromQueue/{repositoryId}")
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
Boolean removeScanningTaskFromQueue( @PathParam ("repositoryId") String repositoryId )
ActionStatus removeScanningTaskFromQueue( @PathParam ("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
@Path ("scanRepositoryNow")
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
Boolean scanRepositoryNow( @QueryParam ("repositoryId") String repositoryId,
ActionStatus scanRepositoryNow( @QueryParam ("repositoryId") String repositoryId,
@QueryParam ("fullScan") boolean fullScan )
throws ArchivaRestServiceException;
@ -101,14 +111,14 @@ public interface RepositoriesService
@Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (noPermission = true)
Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest )
throws ArchivaRestServiceException;
@Path ("scheduleDownloadRemoteIndex")
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (permissions = ArchivaRoleConstants.OPERATION_RUN_INDEXER)
Boolean scheduleDownloadRemoteIndex( @QueryParam ("repositoryId") String repositoryId,
ActionStatus scheduleDownloadRemoteIndex( @QueryParam ("repositoryId") String repositoryId,
@QueryParam ("now") boolean now,
@QueryParam ("fullDownload") boolean fullDownload )
throws ArchivaRestServiceException;
@ -123,7 +133,7 @@ public interface RepositoriesService
@Consumes ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (noPermission = true)
Boolean deleteArtifact( Artifact artifact )
ActionStatus deleteArtifact( Artifact artifact )
throws ArchivaRestServiceException;
/**
@ -134,16 +144,23 @@ public interface RepositoriesService
@DELETE
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (noPermission = true)
Boolean removeProjectVersion( @PathParam ( "repositoryId" ) String repositoryId,
ActionStatus removeProjectVersion( @PathParam ( "repositoryId" ) String repositoryId,
@PathParam ( "namespace" ) String namespace, @PathParam ( "projectId" ) String projectId,
@PathParam ( "version" ) String version )
throws ArchivaRestServiceException;
/**
* Returns the permission status for the current user and the given repository.
* @param repoId the repository identifier
* @return the status
* @throws ArchivaRestServiceException
* @since 3.0
*/
@Path ("isAuthorizedToDeleteArtifacts/{repositoryId}")
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (noPermission = true, noRestriction = true)
Boolean isAuthorizedToDeleteArtifacts( @PathParam ("repositoryId") String repoId )
PermissionStatus getPermissionStatus( @PathParam ("repositoryId") String repoId )
throws ArchivaRestServiceException;
/**
@ -154,7 +171,7 @@ public interface RepositoriesService
@GET
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (noPermission = true)
Boolean deleteGroupId( @QueryParam ("groupId") String groupId, @QueryParam ("repositoryId") String repositoryId )
ActionStatus deleteGroupId( @QueryParam ("groupId") String groupId, @QueryParam ("repositoryId") String repositoryId )
throws ArchivaRestServiceException;
/**
@ -165,7 +182,7 @@ public interface RepositoriesService
@DELETE
@Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN })
@RedbackAuthorization (noPermission = true)
Boolean deleteProject( @PathParam ("groupId") String groupId, @PathParam ("projectId") String projectId,
ActionStatus deleteProject( @PathParam ("groupId") String groupId, @PathParam ("projectId") String projectId,
@PathParam ("repositoryId") String repositoryId )
throws ArchivaRestServiceException;

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.admin.model.beans.RepositoryGroup;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import javax.ws.rs.Consumes;
@ -60,7 +61,7 @@ public interface RepositoryGroupService
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addRepositoryGroup( RepositoryGroup repositoryGroup )
ActionStatus addRepositoryGroup( RepositoryGroup repositoryGroup )
throws ArchivaRestServiceException;
@Path( "updateRepositoryGroup" )
@ -68,21 +69,21 @@ public interface RepositoryGroupService
@Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean updateRepositoryGroup( RepositoryGroup repositoryGroup )
ActionStatus updateRepositoryGroup( RepositoryGroup repositoryGroup )
throws ArchivaRestServiceException;
@Path( "deleteRepositoryGroup/{repositoryGroupId}" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteRepositoryGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId )
ActionStatus deleteRepositoryGroup( @PathParam( "repositoryGroupId" ) String repositoryGroupId )
throws ArchivaRestServiceException;
@Path( "addRepositoryToGroup" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean addRepositoryToGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
ActionStatus addRepositoryToGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
@QueryParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;
@ -90,7 +91,7 @@ public interface RepositoryGroupService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean deleteRepositoryFromGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
ActionStatus deleteRepositoryFromGroup( @QueryParam( "repositoryGroupId" ) String repositoryGroupId,
@QueryParam( "repositoryId" ) String repositoryId )
throws ArchivaRestServiceException;

View File

@ -20,6 +20,7 @@ package org.apache.archiva.rest.api.services;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.CacheEntry;
import org.apache.archiva.rest.api.model.QueueEntry;
import org.apache.archiva.rest.api.model.RepositoryScannerStatistics;
@ -72,14 +73,14 @@ public interface SystemStatusService
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean clearCache( @PathParam( "key" ) String cacheKey )
ActionStatus clearCache( @PathParam( "key" ) String cacheKey )
throws ArchivaRestServiceException;
@Path( "clearAllCaches" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
Boolean clearAllCaches()
ActionStatus clearAllCaches()
throws ArchivaRestServiceException;

View File

@ -312,11 +312,12 @@
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-xml-provider</artifactId>
<scope>runtime</scope>
<version>2.10.4</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
@ -326,11 +327,20 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-logging</artifactId>
</dependency>
<!-- TEST Scope -->
<dependency>
@ -456,6 +466,7 @@
<exclude>src/test/repo-with-osgi-stage/**</exclude>
<exclude>src/test/repo-with-classifier-only/**</exclude>
<exclude>src/test/repo-with-snapshots/**</exclude>
<exclude>src/main/resources/META-INF/cxf/org.apache.cxf.Logger</exclude>
</excludes>
</configuration>
</plugin>

View File

@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.admin.ArchivaAdministration;
import org.apache.archiva.admin.model.beans.*;
import org.apache.archiva.repository.scanner.RepositoryContentConsumers;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.archiva.rest.api.services.ArchivaAdministrationService;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
@ -68,13 +69,13 @@ public class DefaultArchivaAdministrationService
@Override
public Boolean deleteLegacyArtifactPath( String path )
public ActionStatus deleteLegacyArtifactPath( String path )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.deleteLegacyArtifactPath( path, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus( true );
}
catch ( RepositoryAdminException e )
{
@ -84,13 +85,13 @@ public class DefaultArchivaAdministrationService
@Override
public Boolean addFileTypePattern( String fileTypeId, String pattern )
public ActionStatus addFileTypePattern( String fileTypeId, String pattern )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.addFileTypePattern( fileTypeId, pattern, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -99,13 +100,13 @@ public class DefaultArchivaAdministrationService
}
@Override
public Boolean removeFileTypePattern( String fileTypeId, String pattern )
public ActionStatus removeFileTypePattern( String fileTypeId, String pattern )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeFileTypePattern( fileTypeId, pattern, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -142,13 +143,13 @@ public class DefaultArchivaAdministrationService
}
@Override
public Boolean removeFileType( String fileTypeId )
public ActionStatus removeFileType( String fileTypeId )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeFileType( fileTypeId, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -157,13 +158,13 @@ public class DefaultArchivaAdministrationService
}
@Override
public Boolean enabledKnownContentConsumer( String knownContentConsumer )
public ActionStatus enabledKnownContentConsumer( String knownContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.addKnownContentConsumer( knownContentConsumer, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -186,13 +187,13 @@ public class DefaultArchivaAdministrationService
}
@Override
public Boolean disabledKnownContentConsumer( String knownContentConsumer )
public ActionStatus disabledKnownContentConsumer( String knownContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeKnownContentConsumer( knownContentConsumer, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -201,13 +202,13 @@ public class DefaultArchivaAdministrationService
}
@Override
public Boolean enabledInvalidContentConsumer( String invalidContentConsumer )
public ActionStatus enabledInvalidContentConsumer( String invalidContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.addInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -230,13 +231,13 @@ public class DefaultArchivaAdministrationService
}
@Override
public Boolean disabledInvalidContentConsumer( String invalidContentConsumer )
public ActionStatus disabledInvalidContentConsumer( String invalidContentConsumer )
throws ArchivaRestServiceException
{
try
{
archivaAdministration.removeInvalidContentConsumer( invalidContentConsumer, getAuditInformation() );
return Boolean.TRUE;
return new ActionStatus(true);
}
catch ( RepositoryAdminException e )
{
@ -319,12 +320,6 @@ public class DefaultArchivaAdministrationService
}
}
@Override
public Boolean registrationDisabled()
throws ArchivaRestServiceException
{
return getUiConfiguration().isDisableRegistration();
}
@Override
public UiConfiguration getUiConfiguration()

View File

@ -25,6 +25,7 @@ import org.apache.archiva.admin.model.beans.FileLockConfiguration;
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
import org.apache.archiva.common.filelock.FileLockManager;
import org.apache.archiva.components.cache.Cache;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ArchivaRuntimeConfigurationService;
import org.springframework.stereotype.Service;
@ -67,7 +68,7 @@ public class DefaultArchivaRuntimeConfigurationService
}
@Override
public Boolean updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
public ActionStatus updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
throws ArchivaRestServiceException
{
try
@ -95,6 +96,6 @@ public class DefaultArchivaRuntimeConfigurationService
{
throw new ArchivaRestServiceException( e.getMessage(), e );
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
}

View File

@ -613,8 +613,8 @@ public class DefaultBrowseService
}
@Override
public Boolean addMetadata( String groupId, String artifactId, String version, String key, String value,
String repositoryId )
public ActionStatus addMetadata( String groupId, String artifactId, String version, String key, String value,
String repositoryId )
throws ArchivaRestServiceException
{
ProjectVersionMetadata projectVersionMetadata =
@ -622,7 +622,7 @@ public class DefaultBrowseService
if ( projectVersionMetadata == null )
{
return Boolean.FALSE;
return new ActionStatus( false );
}
Map<String, String> properties = new HashMap<>();
@ -672,11 +672,11 @@ public class DefaultBrowseService
{
repositorySession.close();
}
return Boolean.TRUE;
return new ActionStatus( true );
}
@Override
public Boolean deleteMetadata( String groupId, String artifactId, String version, String key, String repositoryId )
public ActionStatus deleteMetadata( String groupId, String artifactId, String version, String key, String repositoryId )
throws ArchivaRestServiceException
{
ProjectVersionMetadata projectVersionMetadata =
@ -684,7 +684,7 @@ public class DefaultBrowseService
if ( projectVersionMetadata == null )
{
return Boolean.FALSE;
return new ActionStatus( false );
}
GenericMetadataFacet metadataFacet =
@ -698,7 +698,7 @@ public class DefaultBrowseService
}
else
{
return Boolean.TRUE;
return new ActionStatus( true );
}
RepositorySession repositorySession = null;
@ -729,7 +729,7 @@ public class DefaultBrowseService
{
repositorySession.close();
}
return Boolean.TRUE;
return new ActionStatus( true );
}
@Override
@ -883,8 +883,8 @@ public class DefaultBrowseService
}
@Override
public Boolean artifactAvailable( String groupId, String artifactId, String version, String classifier,
String repositoryId )
public AvailabilityStatus artifactAvailable( String groupId, String artifactId, String version, String classifier,
String repositoryId )
throws ArchivaRestServiceException
{
List<String> selectedRepos = getSelectedRepos( repositoryId );
@ -920,7 +920,7 @@ public class DefaultBrowseService
if ( file != null && file.exists() )
{
return true;
return new AvailabilityStatus( true );
}
// in case of SNAPSHOT we can have timestamped version locally !
@ -946,7 +946,7 @@ public class DefaultBrowseService
log.debug( "try to find timestamped snapshot version file: {}", timeStampFile.getPath() );
if ( timeStampFile.exists() )
{
return true;
return new AvailabilityStatus( true );
}
}
}
@ -960,7 +960,7 @@ public class DefaultBrowseService
// download pom now
String pomPath = StringUtils.substringBeforeLast( path, ".jar" ) + ".pom";
proxyHandler.fetchFromProxies( managedRepositoryContent.getRepository(), pomPath );
return true;
return new AvailabilityStatus( true );
}
}
} catch ( RepositoryException e )
@ -970,11 +970,11 @@ public class DefaultBrowseService
Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
}
return false;
return new AvailabilityStatus( false );
}
@Override
public Boolean artifactAvailable( String groupId, String artifactId, String version, String repositoryId )
public AvailabilityStatus artifactAvailable( String groupId, String artifactId, String version, String repositoryId )
throws ArchivaRestServiceException
{
return artifactAvailable( groupId, artifactId, version, null, repositoryId );
@ -1093,16 +1093,16 @@ public class DefaultBrowseService
}
@Override
public Boolean importMetadata( MetadataAddRequest metadataAddRequest, String repositoryId )
public ActionStatus importMetadata( MetadataAddRequest metadataAddRequest, String repositoryId )
throws ArchivaRestServiceException
{
boolean result = true;
ActionStatus result = new ActionStatus( true );
for ( Map.Entry<String, String> metadata : metadataAddRequest.getMetadatas().entrySet() )
{
result = addMetadata( metadataAddRequest.getGroupId(), metadataAddRequest.getArtifactId(),
metadataAddRequest.getVersion(), metadata.getKey(), metadata.getValue(),
repositoryId );
if ( !result )
if ( !result.isSuccess() )
{
break;
}

View File

@ -21,6 +21,8 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.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.model.ActionStatus;
import org.apache.archiva.rest.api.model.ValidationStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.CommonServices;
import org.apache.commons.lang3.StringUtils;
@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.ws.rs.core.Response;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@ -187,9 +190,9 @@ public class DefaultCommonServices
@Override
public Boolean validateCronExpression( String cronExpression )
public ValidationStatus validateCronExpression( String cronExpression )
throws ArchivaRestServiceException
{
return cronExpressionValidator.validate( cronExpression );
return new ValidationStatus(cronExpressionValidator.validate( cronExpression ));
}
}

View File

@ -27,7 +27,9 @@ import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsManager;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArchivaRepositoryStatistics;
import org.apache.archiva.rest.api.model.FileStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.commons.lang3.StringEscapeUtils;
@ -95,13 +97,13 @@ public class DefaultManagedRepositoriesService
@Override
public Boolean deleteManagedRepository( String repoId, boolean deleteContent )
public ActionStatus deleteManagedRepository( String repoId, boolean deleteContent )
throws ArchivaRestServiceException
{
try
{
return managedRepositoryAdmin.deleteManagedRepository( repoId, getAuditInformation(), deleteContent );
return new ActionStatus( managedRepositoryAdmin.deleteManagedRepository( repoId, getAuditInformation( ), deleteContent ) );
}
catch ( RepositoryAdminException e )
{
@ -134,16 +136,16 @@ public class DefaultManagedRepositoriesService
@Override
public Boolean updateManagedRepository( ManagedRepository managedRepository )
public ActionStatus updateManagedRepository( ManagedRepository managedRepository )
throws ArchivaRestServiceException
{
try
{
return managedRepositoryAdmin.updateManagedRepository( managedRepository,
managedRepository.isStageRepoNeeded(),
getAuditInformation(),
managedRepository.isResetStats() );
return new ActionStatus( managedRepositoryAdmin.updateManagedRepository( managedRepository,
managedRepository.isStageRepoNeeded( ),
getAuditInformation( ),
managedRepository.isResetStats( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -152,11 +154,11 @@ public class DefaultManagedRepositoriesService
}
@Override
public Boolean fileLocationExists( String fileLocation )
public FileStatus getFileStatus( String fileLocation )
throws ArchivaRestServiceException
{
String location = repositoryCommonValidator.removeExpressions( fileLocation );
return Files.exists( Paths.get( location ));
return new FileStatus( Files.exists( Paths.get( location ) ) );
}
@Override

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.NetworkProxy;
import org.apache.archiva.admin.model.networkproxy.NetworkProxyAdmin;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.NetworkProxyService;
import org.springframework.stereotype.Service;
@ -106,13 +107,13 @@ public class DefaultNetworkProxyService
}
@Override
public Boolean deleteNetworkProxy( String networkProxyId )
public ActionStatus deleteNetworkProxy( String networkProxyId )
throws ArchivaRestServiceException
{
try
{
getNetworkProxyAdmin().deleteNetworkProxy( networkProxyId, getAuditInformation() );
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ProxyConnectorRule;
import org.apache.archiva.admin.model.proxyconnectorrule.ProxyConnectorRuleAdmin;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ProxyConnectorRuleService;
import org.apache.commons.lang3.StringUtils;
@ -87,7 +88,7 @@ public class DefaultProxyConnectorRuleService
}
@Override
public Boolean addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
public ActionStatus addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
@ -96,7 +97,7 @@ public class DefaultProxyConnectorRuleService
try
{
proxyConnectorRuleAdmin.addProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
@ -105,13 +106,13 @@ public class DefaultProxyConnectorRuleService
}
@Override
public Boolean deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
public ActionStatus deleteProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
try
{
proxyConnectorRuleAdmin.deleteProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
@ -120,13 +121,13 @@ public class DefaultProxyConnectorRuleService
}
@Override
public Boolean updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
public ActionStatus updateProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
try
{
proxyConnectorRuleAdmin.updateProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{

View File

@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ProxyConnector;
import org.apache.archiva.admin.model.proxyconnector.ProxyConnectorAdmin;
import org.apache.archiva.policies.Policy;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.PolicyInformation;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ProxyConnectorService;
@ -80,16 +81,16 @@ public class DefaultProxyConnectorService
}
@Override
public Boolean addProxyConnector( ProxyConnector proxyConnector )
public ActionStatus addProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
return Boolean.FALSE;
return ActionStatus.FAIL;
}
try
{
return proxyConnectorAdmin.addProxyConnector( proxyConnector, getAuditInformation() );
return new ActionStatus( proxyConnectorAdmin.addProxyConnector( proxyConnector, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -98,16 +99,16 @@ public class DefaultProxyConnectorService
}
@Override
public Boolean deleteProxyConnector( ProxyConnector proxyConnector )
public ActionStatus deleteProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
return Boolean.FALSE;
return ActionStatus.FAIL;
}
try
{
return proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getAuditInformation() );
return new ActionStatus( proxyConnectorAdmin.deleteProxyConnector( proxyConnector, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -116,7 +117,7 @@ public class DefaultProxyConnectorService
}
@Override
public Boolean removeProxyConnector( String sourceRepoId, String targetRepoId )
public ActionStatus removeProxyConnector( String sourceRepoId, String targetRepoId )
throws ArchivaRestServiceException
{
ProxyConnector proxyConnector = getProxyConnector( sourceRepoId, targetRepoId );
@ -130,16 +131,16 @@ public class DefaultProxyConnectorService
}
@Override
public Boolean updateProxyConnector( ProxyConnector proxyConnector )
public ActionStatus updateProxyConnector( ProxyConnector proxyConnector )
throws ArchivaRestServiceException
{
if ( proxyConnector == null )
{
return Boolean.FALSE;
return ActionStatus.FAIL;
}
try
{
return proxyConnectorAdmin.updateProxyConnector( proxyConnector, getAuditInformation() );
return new ActionStatus( proxyConnectorAdmin.updateProxyConnector( proxyConnector, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{

View File

@ -34,6 +34,7 @@ import org.apache.archiva.redback.policy.PasswordRule;
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.role.RoleManager;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
import org.apache.archiva.rest.api.model.RedbackImplementationsInformations;
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
@ -112,7 +113,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
@Override
public Boolean updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
public ActionStatus updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
throws ArchivaRestServiceException
{
try
@ -221,9 +222,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
catch (ArchivaRestServiceException e) {
log.error(e.getMessage(), e);
@ -303,7 +302,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
@Override
public Boolean checkLdapConnection()
public ActionStatus checkLdapConnection()
throws ArchivaRestServiceException
{
LdapConnection ldapConnection = null;
@ -325,11 +324,11 @@ public class DefaultRedbackRuntimeConfigurationService
}
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
@Override
public Boolean checkLdapConnection( LdapConfiguration ldapConfiguration )
public ActionStatus checkLdapConnection( LdapConfiguration ldapConfiguration )
throws ArchivaRestServiceException
{
LdapConnection ldapConnection = null;
@ -380,7 +379,7 @@ public class DefaultRedbackRuntimeConfigurationService
}
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
private Properties toProperties( Map<String, String> map )

View File

@ -26,6 +26,7 @@ import org.apache.archiva.proxy.ProxyRegistry;
import org.apache.archiva.proxy.maven.WagonFactory;
import org.apache.archiva.proxy.maven.WagonFactoryRequest;
import org.apache.archiva.proxy.model.NetworkProxy;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
import org.apache.commons.lang3.StringUtils;
@ -91,10 +92,10 @@ public class DefaultRemoteRepositoriesService
}
@Override
public Boolean deleteRemoteRepository(String repositoryId)
public ActionStatus deleteRemoteRepository( String repositoryId)
throws ArchivaRestServiceException {
try {
return remoteRepositoryAdmin.deleteRemoteRepository(repositoryId, getAuditInformation());
return new ActionStatus( remoteRepositoryAdmin.deleteRemoteRepository( repositoryId, getAuditInformation( ) ) );
} catch (RepositoryAdminException e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e);
@ -102,10 +103,10 @@ public class DefaultRemoteRepositoriesService
}
@Override
public Boolean addRemoteRepository(RemoteRepository remoteRepository)
public ActionStatus addRemoteRepository(RemoteRepository remoteRepository)
throws ArchivaRestServiceException {
try {
return remoteRepositoryAdmin.addRemoteRepository(remoteRepository, getAuditInformation());
return new ActionStatus( remoteRepositoryAdmin.addRemoteRepository( remoteRepository, getAuditInformation( ) ) );
} catch (RepositoryAdminException e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e);
@ -113,10 +114,10 @@ public class DefaultRemoteRepositoriesService
}
@Override
public Boolean updateRemoteRepository(RemoteRepository remoteRepository)
public ActionStatus updateRemoteRepository(RemoteRepository remoteRepository)
throws ArchivaRestServiceException {
try {
return remoteRepositoryAdmin.updateRemoteRepository(remoteRepository, getAuditInformation());
return new ActionStatus( remoteRepositoryAdmin.updateRemoteRepository( remoteRepository, getAuditInformation( ) ) );
} catch (RepositoryAdminException e) {
log.error(e.getMessage(), e);
throw new ArchivaRestServiceException(e.getMessage(), e.getFieldName(), e);
@ -124,13 +125,13 @@ public class DefaultRemoteRepositoriesService
}
@Override
public Boolean checkRemoteConnectivity(String repositoryId)
public ActionStatus checkRemoteConnectivity( String repositoryId)
throws ArchivaRestServiceException {
try {
RemoteRepository remoteRepository = remoteRepositoryAdmin.getRemoteRepository(repositoryId);
if (remoteRepository == null) {
log.warn("Remote repository {} does not exist. Connectivity check returns false.", repositoryId);
return Boolean.FALSE;
return ActionStatus.FAIL;
}
NetworkProxy networkProxy = null;
if (StringUtils.isNotBlank(remoteRepository.getRemoteDownloadNetworkProxyId())) {
@ -175,22 +176,22 @@ public class DefaultRemoteRepositoriesService
// MRM-1933, there are certain servers that do not allow browsing
if (!(StringUtils.isEmpty(remoteRepository.getCheckPath()) ||
"/".equals(remoteRepository.getCheckPath()))) {
return wagon.resourceExists(remoteRepository.getCheckPath());
return new ActionStatus( wagon.resourceExists( remoteRepository.getCheckPath( ) ) );
} else {
// we only check connectivity as remote repo can be empty
// MRM-1909: Wagon implementation appends a slash already
wagon.getFileList("");
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
} catch (TransferFailedException e) {
log.info("TransferFailedException :{}", e.getMessage());
return Boolean.FALSE;
return ActionStatus.FAIL;
} catch (Exception e) {
// This service returns either true or false, Exception cannot be handled by the clients
log.debug("Exception occured on connectivity test.", e);
log.info("Connection exception: {}", e.getMessage());
return Boolean.FALSE;
return ActionStatus.FAIL;
}
}

View File

@ -71,7 +71,10 @@ import org.apache.archiva.repository.scanner.RepositoryScannerInstance;
import org.apache.archiva.repository.storage.RepositoryStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.repository.storage.fs.FsStorageUtil;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
import org.apache.archiva.rest.api.model.PermissionStatus;
import org.apache.archiva.rest.api.model.ScanStatus;
import org.apache.archiva.rest.api.model.StringList;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoriesService;
@ -156,42 +159,42 @@ public class DefaultRepositoriesService
private List<ChecksumAlgorithm> algorithms = Arrays.asList(ChecksumAlgorithm.SHA256, ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 );
@Override
public Boolean scanRepository( String repositoryId, boolean fullScan )
public ActionStatus scanRepository( String repositoryId, boolean fullScan )
{
return doScanRepository( repositoryId, fullScan );
return new ActionStatus( doScanRepository( repositoryId, fullScan ) );
}
@Override
public Boolean alreadyScanning( String repositoryId )
public ScanStatus getScanStatus( String repositoryId )
{
// check queue first to make sure it doesn't get dequeued between calls
if ( repositoryTaskScheduler.isProcessingRepositoryTask( repositoryId ) )
{
return true;
return new ScanStatus( true );
}
for ( RepositoryScannerInstance scan : repoScanner.getInProgressScans() )
{
if ( scan.getRepository().getId().equals( repositoryId ) )
{
return true;
return new ScanStatus( true );
}
}
return false;
return new ScanStatus( false );
}
@Override
public Boolean removeScanningTaskFromQueue( String repositoryId )
public ActionStatus removeScanningTaskFromQueue( String repositoryId )
{
RepositoryTask task = new RepositoryTask();
task.setRepositoryId( repositoryId );
try
{
return repositoryTaskScheduler.unQueueTask( task );
return new ActionStatus( repositoryTaskScheduler.unQueueTask( task ) );
}
catch ( TaskQueueException e )
{
log.error( "failed to unschedule scanning of repo with id {}", repositoryId, e );
return false;
return ActionStatus.FAIL;
}
}
@ -205,7 +208,7 @@ public class DefaultRepositoriesService
}
@Override
public Boolean scanRepositoryNow( String repositoryId, boolean fullScan )
public ActionStatus scanRepositoryNow( String repositoryId, boolean fullScan )
throws ArchivaRestServiceException
{
@ -225,7 +228,7 @@ public class DefaultRepositoriesService
scheduler.queueTask( new RepositoryTask( repositoryId, fullScan ) );
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
catch ( Exception e )
{
@ -235,7 +238,7 @@ public class DefaultRepositoriesService
}
@Override
public Boolean scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
public ActionStatus scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
throws ArchivaRestServiceException
{
try
@ -247,11 +250,11 @@ public class DefaultRepositoriesService
log.error( e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(), e );
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
@Override
public Boolean copyArtifact( ArtifactTransferRequest artifactTransferRequest )
public ActionStatus copyArtifact( ArtifactTransferRequest artifactTransferRequest )
throws ArchivaRestServiceException
{
// check parameters
@ -487,7 +490,7 @@ public class DefaultRepositoriesService
log.error( "IOException: {}", e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(), e );
}
return true;
return ActionStatus.SUCCESS;
}
private void queueRepositoryTask( String repositoryId, StorageAsset localFile )
@ -616,7 +619,7 @@ public class DefaultRepositoriesService
}
@Override
public Boolean removeProjectVersion( String repositoryId, String namespace, String projectId, String version )
public ActionStatus removeProjectVersion( String repositoryId, String namespace, String projectId, String version )
throws ArchivaRestServiceException
{
// if not a generic we can use the standard way to delete artifact
@ -633,7 +636,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@ -707,11 +710,11 @@ public class DefaultRepositoriesService
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
@Override
public Boolean deleteArtifact( Artifact artifact )
public ActionStatus deleteArtifact( Artifact artifact )
throws ArchivaRestServiceException
{
@ -727,7 +730,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@ -825,7 +828,7 @@ public class DefaultRepositoriesService
//throw new ContentNotFoundException(
// artifact.getNamespace() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion() );
log.warn( "targetPath {} not found skip file deletion", targetPath );
return false;
return ActionStatus.FAIL;
}
// TODO: this should be in the storage mechanism so that it is all tied together
@ -981,11 +984,11 @@ public class DefaultRepositoriesService
repositorySession.close();
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
@Override
public Boolean deleteGroupId( String groupId, String repositoryId )
public ActionStatus deleteGroupId( String groupId, String repositoryId )
throws ArchivaRestServiceException
{
if ( StringUtils.isEmpty( repositoryId ) )
@ -993,7 +996,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@ -1051,11 +1054,11 @@ public class DefaultRepositoriesService
repositorySession.close();
}
return true;
return ActionStatus.SUCCESS;
}
@Override
public Boolean deleteProject( String groupId, String projectId, String repositoryId )
public ActionStatus deleteProject( String groupId, String projectId, String repositoryId )
throws ArchivaRestServiceException
{
if ( StringUtils.isEmpty( repositoryId ) )
@ -1063,7 +1066,7 @@ public class DefaultRepositoriesService
throw new ArchivaRestServiceException( "repositoryId cannot be null", 400, null );
}
if ( !isAuthorizedToDeleteArtifacts( repositoryId ) )
if ( !getPermissionStatus( repositoryId ).isAuthorizedToDeleteArtifacts() )
{
throw new ArchivaRestServiceException( "not authorized to delete artifacts", 403, null );
}
@ -1131,12 +1134,12 @@ public class DefaultRepositoriesService
repositorySession.close();
}
return true;
return ActionStatus.SUCCESS;
}
@Override
public Boolean isAuthorizedToDeleteArtifacts( String repoId )
public PermissionStatus getPermissionStatus( String repoId )
throws ArchivaRestServiceException
{
String userName =
@ -1144,7 +1147,7 @@ public class DefaultRepositoriesService
try
{
return userRepositories.isAuthorizedToDeleteArtifacts( userName, repoId );
return new PermissionStatus( userRepositories.isAuthorizedToDeleteArtifacts( userName, repoId ) );
}
catch ( ArchivaSecurityException e )
{

View File

@ -21,6 +21,7 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.RepositoryGroup;
import org.apache.archiva.admin.model.group.RepositoryGroupAdmin;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoryGroupService;
import org.apache.commons.lang3.StringUtils;
@ -79,16 +80,16 @@ public class DefaultRepositoryGroupService
}
@Override
public Boolean addRepositoryGroup( RepositoryGroup repoGroup )
public ActionStatus addRepositoryGroup( RepositoryGroup repoGroup )
throws ArchivaRestServiceException
{
try
{
return repositoryGroupAdmin.addRepositoryGroup(
new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId(), new ArrayList<>(
repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ).mergedIndexTtl(
repoGroup.getMergedIndexTtl() ).cronExpression( repoGroup.getCronExpression() ),
getAuditInformation() );
return new ActionStatus( repositoryGroupAdmin.addRepositoryGroup(
new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId( ), new ArrayList<>(
repoGroup.getRepositories( ) ) ).mergedIndexPath( repoGroup.getMergedIndexPath( ) ).mergedIndexTtl(
repoGroup.getMergedIndexTtl( ) ).cronExpression( repoGroup.getCronExpression( ) ),
getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -97,16 +98,16 @@ public class DefaultRepositoryGroupService
}
@Override
public Boolean updateRepositoryGroup( RepositoryGroup repoGroup )
public ActionStatus updateRepositoryGroup( RepositoryGroup repoGroup )
throws ArchivaRestServiceException
{
try
{
return repositoryGroupAdmin.updateRepositoryGroup(
new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId(), new ArrayList<>(
repoGroup.getRepositories() ) ).mergedIndexPath( repoGroup.getMergedIndexPath() ).mergedIndexTtl(
repoGroup.getMergedIndexTtl() ).cronExpression( repoGroup.getCronExpression() ),
getAuditInformation() );
return new ActionStatus( repositoryGroupAdmin.updateRepositoryGroup(
new org.apache.archiva.admin.model.beans.RepositoryGroup( repoGroup.getId( ), new ArrayList<>(
repoGroup.getRepositories( ) ) ).mergedIndexPath( repoGroup.getMergedIndexPath( ) ).mergedIndexTtl(
repoGroup.getMergedIndexTtl( ) ).cronExpression( repoGroup.getCronExpression( ) ),
getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -115,12 +116,12 @@ public class DefaultRepositoryGroupService
}
@Override
public Boolean deleteRepositoryGroup( String repositoryGroupId )
public ActionStatus deleteRepositoryGroup( String repositoryGroupId )
throws ArchivaRestServiceException
{
try
{
return repositoryGroupAdmin.deleteRepositoryGroup( repositoryGroupId, getAuditInformation() );
return new ActionStatus( repositoryGroupAdmin.deleteRepositoryGroup( repositoryGroupId, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -129,12 +130,12 @@ public class DefaultRepositoryGroupService
}
@Override
public Boolean addRepositoryToGroup( String repositoryGroupId, String repositoryId )
public ActionStatus addRepositoryToGroup( String repositoryGroupId, String repositoryId )
throws ArchivaRestServiceException
{
try
{
return repositoryGroupAdmin.addRepositoryToGroup( repositoryGroupId, repositoryId, getAuditInformation() );
return new ActionStatus( repositoryGroupAdmin.addRepositoryToGroup( repositoryGroupId, repositoryId, getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{
@ -143,13 +144,13 @@ public class DefaultRepositoryGroupService
}
@Override
public Boolean deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId )
public ActionStatus deleteRepositoryFromGroup( String repositoryGroupId, String repositoryId )
throws ArchivaRestServiceException
{
try
{
return repositoryGroupAdmin.deleteRepositoryFromGroup( repositoryGroupId, repositoryId,
getAuditInformation() );
return new ActionStatus( repositoryGroupAdmin.deleteRepositoryFromGroup( repositoryGroupId, repositoryId,
getAuditInformation( ) ) );
}
catch ( RepositoryAdminException e )
{

View File

@ -26,6 +26,7 @@ import org.apache.archiva.components.taskqueue.TaskQueue;
import org.apache.archiva.components.taskqueue.TaskQueueException;
import org.apache.archiva.repository.scanner.RepositoryScanner;
import org.apache.archiva.repository.scanner.RepositoryScannerInstance;
import org.apache.archiva.rest.api.model.ActionStatus;
import org.apache.archiva.rest.api.model.CacheEntry;
import org.apache.archiva.rest.api.model.ConsumerScanningStatistics;
import org.apache.archiva.rest.api.model.QueueEntry;
@ -165,7 +166,7 @@ public class DefaultSystemStatusService
}
@Override
public Boolean clearCache( String cacheKey )
public ActionStatus clearCache( String cacheKey )
throws ArchivaRestServiceException
{
Cache cache = caches.get( cacheKey );
@ -176,18 +177,18 @@ public class DefaultSystemStatusService
}
cache.clear();
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
@Override
public Boolean clearAllCaches()
public ActionStatus clearAllCaches()
throws ArchivaRestServiceException
{
for ( Cache cache : caches.values() )
{
cache.clear();
}
return Boolean.TRUE;
return ActionStatus.SUCCESS;
}
@Override

View File

@ -0,0 +1 @@
org.apache.cxf.common.logging.Slf4jLogger

View File

@ -40,10 +40,16 @@
base-package="org.apache.archiva.rest.services,org.apache.archiva.redback.rest.services"/>
<bean id="eventSender" class="org.apache.cxf.ext.logging.slf4j.Slf4jVerboseEventSender">
<property name="loggingLevel" value="DEBUG" />
</bean>
<jaxrs:server id="archivaServices" address="/archivaServices" >
<jaxrs:providers>
<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"/>
<bean class="com.fasterxml.jackson.jaxrs.xml.JacksonJaxbXMLProvider"/>
<ref bean="authenticationInterceptor#rest"/>
<ref bean="permissionInterceptor#rest"/>
<ref bean="requestValidationInterceptor#rest" />
@ -72,6 +78,13 @@
<ref bean="redbackRuntimeConfigurationService#rest"/>
</jaxrs:serviceBeans>
<jaxrs:features>
<bean class="org.apache.cxf.ext.logging.LoggingFeature">
<property name="sender" ref="eventSender"/>
</bean>
</jaxrs:features>
</jaxrs:server>
<bean name="browse#versionMetadata" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"

View File

@ -20,6 +20,7 @@ package org.apache.archiva.rest.services;
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.fasterxml.jackson.jaxrs.xml.JacksonJaxbXMLProvider;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.apache.archiva.redback.rest.services.AbstractRestServicesTest;
@ -50,7 +51,6 @@ import org.junit.Assume;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
@ -58,11 +58,10 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalTime;
import java.util.Collections;
import java.util.Arrays;
import java.util.Date;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
/**
* @author Olivier Lamy
@ -238,7 +237,7 @@ public abstract class AbstractArchivaRestTest
protected <T> T getService( Class<T> clazz, String authzHeader )
{
T service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", clazz,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
if ( authzHeader != null )
{
@ -296,7 +295,7 @@ public abstract class AbstractArchivaRestTest
{
return JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
RepositoryGroupService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
}
protected ProxyConnectorService getProxyConnectorService()
@ -304,7 +303,7 @@ public abstract class AbstractArchivaRestTest
ProxyConnectorService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ProxyConnectorService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
WebClient.client(service).header("Referer","http://localhost:"+getServerPort());
@ -319,7 +318,7 @@ public abstract class AbstractArchivaRestTest
NetworkProxyService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
NetworkProxyService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).header( "Authorization", authorizationHeader );
WebClient.client(service).header("Referer","http://localhost:"+getServerPort());
@ -334,7 +333,7 @@ public abstract class AbstractArchivaRestTest
ArchivaAdministrationService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
ArchivaAdministrationService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@ -351,7 +350,7 @@ public abstract class AbstractArchivaRestTest
RedbackRuntimeConfigurationService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
RedbackRuntimeConfigurationService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE );
WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE );
@ -368,7 +367,7 @@ public abstract class AbstractArchivaRestTest
BrowseService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
BrowseService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
// to add authentification
if ( authzHeader != null )
{
@ -399,7 +398,7 @@ public abstract class AbstractArchivaRestTest
SearchService service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
SearchService.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
// to add authentification
if ( authzHeader != null )
{
@ -422,7 +421,7 @@ public abstract class AbstractArchivaRestTest
CommonServices service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
CommonServices.class,
Collections.singletonList( new JacksonJaxbJsonProvider() ) );
Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
if ( authzHeader != null )
{
@ -664,7 +663,7 @@ public abstract class AbstractArchivaRestTest
protected void waitForScanToComplete( String repoId )
throws ArchivaRestServiceException, InterruptedException
{
while ( getRepositoriesService( authorizationHeader ).alreadyScanning( repoId ) ) {
while ( getRepositoriesService( authorizationHeader ).getScanStatus( repoId ).isAlreadyScanning() ) {
// Would be better to cancel, if we had that capacity
Thread.sleep( 100 );
}

View File

@ -22,7 +22,6 @@ import org.apache.archiva.admin.model.beans.FileType;
import org.apache.archiva.admin.model.beans.OrganisationInformation;
import org.apache.archiva.admin.model.beans.UiConfiguration;
import org.apache.archiva.rest.api.model.AdminRepositoryConsumer;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

View File

@ -32,7 +32,7 @@ public class CommonServicesTest
throws Exception
{
CommonServices commonServices = getCommonServices( null );
assertTrue( commonServices.validateCronExpression( "0 0,30 * * * ?" ) );
assertTrue( commonServices.validateCronExpression( "0 0,30 * * * ?" ).isValid() );
}
@Test
@ -40,6 +40,6 @@ public class CommonServicesTest
throws Exception
{
CommonServices commonServices = getCommonServices( null );
assertFalse( commonServices.validateCronExpression( "0,30 * * * ?" ) );
assertFalse( commonServices.validateCronExpression( "0,30 * * * ?" ).isValid() );
}
}

View File

@ -56,7 +56,7 @@ public class CopyArtifactTest
// retrieve the service
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
// copy the artifact
Boolean res = repositoriesService.copyArtifact( artifactTransferRequest );
Boolean res = repositoriesService.copyArtifact( artifactTransferRequest ).isSuccess();
// END SNIPPET: copy-artifact
assertTrue( res );

View File

@ -26,7 +26,6 @@ import org.apache.archiva.rest.api.services.RepositoriesService;
import org.junit.Test;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
@ -58,7 +57,7 @@ public class ManagedRepositoriesServiceTest
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
while ( timeout > 0 && repositoriesService.getScanStatus( repo.getId() ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
@ -85,7 +84,7 @@ public class ManagedRepositoriesServiceTest
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
while ( timeout > 0 && repositoriesService.getScanStatus( repo.getId() ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
@ -104,7 +103,7 @@ public class ManagedRepositoriesServiceTest
assertEquals( "toto", repo.getName() );
timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( repo.getId() ) )
while ( timeout > 0 && repositoriesService.getScanStatus( repo.getId() ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
@ -122,10 +121,10 @@ public class ManagedRepositoriesServiceTest
ManagedRepositoriesService service = getManagedRepositoriesService( authorizationHeader );
Path target = getProjectDirectory().resolve( "target" );
assertTrue( service.fileLocationExists( target.toAbsolutePath().toString() ) );
assertTrue( service.getFileStatus( target.toAbsolutePath().toString() ).isExists() );
// normally should not exists :-)
assertFalse( service.fileLocationExists( "/fooofofof/foddfdofd/dedede/kdeo" ) );
assertFalse( service.getFileStatus( "/fooofofof/foddfdofd/dedede/kdeo" ).isExists() );
}
@ -151,7 +150,7 @@ public class ManagedRepositoriesServiceTest
repositoriesService.scanRepositoryDirectoriesNow( testRepoId );
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( testRepoId ) )
while ( timeout > 0 && repositoriesService.getScanStatus( testRepoId ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;

View File

@ -176,7 +176,7 @@ public class RemoteRepositoriesServiceTest
service.addRemoteRepository(getRemoteRepository());
assertTrue(service.checkRemoteConnectivity("id-new"));
assertTrue(service.checkRemoteConnectivity("id-new").isSuccess());
} finally {
removeRemoteRepositories("id-new");
}
@ -198,7 +198,7 @@ public class RemoteRepositoriesServiceTest
service.addRemoteRepository(getRemoteMavenRepository());
assertTrue(service.checkRemoteConnectivity("id-maven1"));
assertTrue(service.checkRemoteConnectivity("id-maven1").isSuccess());
} finally {
removeRemoteRepositories("id-maven1");
}
@ -222,7 +222,7 @@ public class RemoteRepositoriesServiceTest
service.addRemoteRepository(getRemoteOracleRepository());
assertTrue(service.checkRemoteConnectivity("id-oracle"));
assertTrue(service.checkRemoteConnectivity("id-oracle").isSuccess());
} finally {
removeRemoteRepositories("id-oracle");
}

View File

@ -21,7 +21,6 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
import org.apache.archiva.redback.rest.api.services.UserService;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.BrowseResultEntry;
@ -37,7 +36,6 @@ import javax.ws.rs.ForbiddenException;
import javax.ws.rs.core.Response;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Locale;
@ -77,13 +75,13 @@ public class RepositoriesServiceTest
String repoId = managedRepositoriesService.getManagedRepositories().get( 0 ).getId();
int timeout = 20000;
while ( timeout > 0 && service.alreadyScanning( repoId ) )
while ( timeout > 0 && service.getScanStatus( repoId ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
}
assertTrue( service.scanRepository( repoId, true ) );
assertTrue( service.scanRepository( repoId, true ).isSuccess() );
}
@Test( expected = ForbiddenException.class )
@ -393,7 +391,7 @@ public class RepositoriesServiceTest
{
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
assertTrue( repositoriesService.isAuthorizedToDeleteArtifacts( managedRepository.getId() ) );
assertTrue( repositoriesService.getPermissionStatus( managedRepository.getId() ).isAuthorizedToDeleteArtifacts() );
}
finally
{
@ -413,7 +411,7 @@ public class RepositoriesServiceTest
{
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService( );
assertFalse( repositoriesService.isAuthorizedToDeleteArtifacts( managedRepository.getId() ) );
assertFalse( repositoriesService.getPermissionStatus( managedRepository.getId() ).isAuthorizedToDeleteArtifacts() );
}
finally
{

View File

@ -49,7 +49,8 @@
<logger name="org.apache.archiva.rest.services" level="info"/>
<logger name="org.springframework" level="error"/>
<logger name="org.apache.commons.configuration" level="info"/>
<logger name="org.apache.archiva.metadata.repository.storage.maven2" level="error" />
<logger name="org.apache.archiva.metadata" level="error" />
<logger name="org.apache.cxf" level="debug" />
<root level="info">
<appender-ref ref="console"/>

View File

@ -38,7 +38,6 @@ import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Locale;
/**
@ -129,7 +128,7 @@ public class DownloadArtifactFromQueryTest
// wait a bit to ensure index is finished
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( id ) )
while ( timeout > 0 && repositoriesService.getScanStatus( id ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;

View File

@ -43,10 +43,6 @@ import org.junit.runner.RunWith;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@ -145,7 +141,7 @@ public class DownloadMergedIndexNonDefaultPathTest
// wait a bit to ensure index is finished
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( id ) )
while ( timeout > 0 && repositoriesService.getScanStatus( id ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;

View File

@ -43,7 +43,6 @@ import org.junit.runner.RunWith;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@ -136,7 +135,7 @@ public class DownloadMergedIndexTest
// wait a bit to ensure index is finished
int timeout = 20000;
while ( timeout > 0 && repositoriesService.alreadyScanning( id ) )
while ( timeout > 0 && repositoriesService.getScanStatus( id ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;

View File

@ -37,7 +37,6 @@ import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Locale;
import static org.assertj.core.api.Assertions.assertThat;
@ -110,7 +109,7 @@ public class RemoteRepositoryConnectivityCheckTest
service.addRemoteRepository( repo );
assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
assertThat( service.checkRemoteConnectivity( repo.getId() ).isSuccess() ).isTrue();
}
finally
{
@ -145,7 +144,7 @@ public class RemoteRepositoryConnectivityCheckTest
service.addRemoteRepository( repo );
assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
assertThat( service.checkRemoteConnectivity( repo.getId() ).isSuccess() ).isTrue();
}
finally
{
@ -173,7 +172,7 @@ public class RemoteRepositoryConnectivityCheckTest
service.addRemoteRepository( repo );
assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isFalse();
assertThat( service.checkRemoteConnectivity( repo.getId() ).isSuccess() ).isFalse();
}
finally
{

View File

@ -707,18 +707,22 @@
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-extension-providers</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-features-logging</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-rest-api</artifactId>