--- /dev/null
+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;
+ }
+
+
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+}
--- /dev/null
+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;
+ }
+}
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;
@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" )
@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" )
@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" )
@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" )
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} )
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;
@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;
}
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;
@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}")
@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;
/**
@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;
/**
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;
@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;
}
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;
@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;
@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;
/**
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;
@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;
}
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;
@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" )
@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;
/**
@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;
}
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;
@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" )
@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;
/**
@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;
@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" )
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;
@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")
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
@RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
- Boolean checkLdapConnection()
+ ActionStatus checkLdapConnection()
throws ArchivaRestServiceException;
@Path("checkLdapConnection")
@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;
}
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;
@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;
@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;
@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;
}
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;
@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;
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;
@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;
@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;
/**
@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;
/**
@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;
/**
@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;
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;
@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" )
@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;
@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;
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;
@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;
<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>
<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>
<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>
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;
@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 )
{
@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 )
{
}
@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 )
{
}
@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 )
{
}
@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 )
{
}
@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 )
{
}
@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 )
{
}
@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 )
{
}
}
- @Override
- public Boolean registrationDisabled()
- throws ArchivaRestServiceException
- {
- return getUiConfiguration().isDisableRegistration();
- }
@Override
public UiConfiguration getUiConfiguration()
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;
}
@Override
- public Boolean updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
+ public ActionStatus updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
throws ArchivaRestServiceException
{
try
{
throw new ArchivaRestServiceException( e.getMessage(), e );
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
}
}
@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 =
if ( projectVersionMetadata == null )
{
- return Boolean.FALSE;
+ return new ActionStatus( false );
}
Map<String, String> properties = new HashMap<>();
{
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 =
if ( projectVersionMetadata == null )
{
- return Boolean.FALSE;
+ return new ActionStatus( false );
}
GenericMetadataFacet metadataFacet =
}
else
{
- return Boolean.TRUE;
+ return new ActionStatus( true );
}
RepositorySession repositorySession = null;
{
repositorySession.close();
}
- return Boolean.TRUE;
+ return new ActionStatus( true );
}
@Override
}
@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 );
if ( file != null && file.exists() )
{
- return true;
+ return new AvailabilityStatus( true );
}
// in case of SNAPSHOT we can have timestamped version locally !
log.debug( "try to find timestamped snapshot version file: {}", timeStampFile.getPath() );
if ( timeStampFile.exists() )
{
- return true;
+ return new AvailabilityStatus( true );
}
}
}
// download pom now
String pomPath = StringUtils.substringBeforeLast( path, ".jar" ) + ".pom";
proxyHandler.fetchFromProxies( managedRepositoryContent.getRepository(), pomPath );
- return true;
+ return new AvailabilityStatus( true );
}
}
} catch ( RepositoryException e )
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 );
}
@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;
}
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;
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;
@Override
- public Boolean validateCronExpression( String cronExpression )
+ public ValidationStatus validateCronExpression( String cronExpression )
throws ArchivaRestServiceException
{
- return cronExpressionValidator.validate( cronExpression );
+ return new ValidationStatus(cronExpressionValidator.validate( cronExpression ));
}
}
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;
@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 )
{
@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 )
{
}
@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
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;
}
@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 )
{
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;
}
@Override
- public Boolean addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
+ public ActionStatus addProxyConnectorRule( ProxyConnectorRule proxyConnectorRule )
throws ArchivaRestServiceException
{
try
{
proxyConnectorRuleAdmin.addProxyConnectorRule( proxyConnectorRule, getAuditInformation() );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( RepositoryAdminException e )
{
}
@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 )
{
}
@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 )
{
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;
}
@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 )
{
}
@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 )
{
}
@Override
- public Boolean removeProxyConnector( String sourceRepoId, String targetRepoId )
+ public ActionStatus removeProxyConnector( String sourceRepoId, String targetRepoId )
throws ArchivaRestServiceException
{
ProxyConnector proxyConnector = getProxyConnector( sourceRepoId, targetRepoId );
}
@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 )
{
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;
}
@Override
- public Boolean updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
+ public ActionStatus updateRedbackRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
throws ArchivaRestServiceException
{
try
}
-
-
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch (ArchivaRestServiceException e) {
log.error(e.getMessage(), e);
}
@Override
- public Boolean checkLdapConnection()
+ public ActionStatus checkLdapConnection()
throws ArchivaRestServiceException
{
LdapConnection ldapConnection = null;
}
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean checkLdapConnection( LdapConfiguration ldapConfiguration )
+ public ActionStatus checkLdapConnection( LdapConfiguration ldapConfiguration )
throws ArchivaRestServiceException
{
LdapConnection ldapConnection = null;
}
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
private Properties toProperties( Map<String, String> map )
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;
}
@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);
}
@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);
}
@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);
}
@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())) {
// 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;
}
}
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;
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;
}
}
}
@Override
- public Boolean scanRepositoryNow( String repositoryId, boolean fullScan )
+ public ActionStatus scanRepositoryNow( String repositoryId, boolean fullScan )
throws ArchivaRestServiceException
{
scheduler.queueTask( new RepositoryTask( repositoryId, fullScan ) );
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
catch ( Exception e )
{
}
@Override
- public Boolean scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
+ public ActionStatus scheduleDownloadRemoteIndex( String repositoryId, boolean now, boolean fullDownload )
throws ArchivaRestServiceException
{
try
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
log.error( "IOException: {}", e.getMessage(), e );
throw new ArchivaRestServiceException( e.getMessage(), e );
}
- return true;
+ return ActionStatus.SUCCESS;
}
private void queueRepositoryTask( String repositoryId, StorageAsset localFile )
}
@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
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 );
}
}
- return Boolean.TRUE;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean deleteArtifact( Artifact artifact )
+ public ActionStatus deleteArtifact( Artifact artifact )
throws ArchivaRestServiceException
{
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 );
}
//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
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 ) )
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 );
}
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 ) )
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 );
}
repositorySession.close();
}
- return true;
+ return ActionStatus.SUCCESS;
}
@Override
- public Boolean isAuthorizedToDeleteArtifacts( String repoId )
+ public PermissionStatus getPermissionStatus( String repoId )
throws ArchivaRestServiceException
{
String userName =
try
{
- return userRepositories.isAuthorizedToDeleteArtifacts( userName, repoId );
+ return new PermissionStatus( userRepositories.isAuthorizedToDeleteArtifacts( userName, repoId ) );
}
catch ( ArchivaSecurityException e )
{
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;
}
@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 )
{
}
@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 )
{
}
@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 )
{
}
@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 )
{
}
@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 )
{
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;
}
@Override
- public Boolean clearCache( String cacheKey )
+ public ActionStatus clearCache( String cacheKey )
throws ArchivaRestServiceException
{
Cache cache = caches.get( cacheKey );
}
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
--- /dev/null
+org.apache.cxf.common.logging.Slf4jLogger
\ No newline at end of file
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" />
<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"
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;
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;
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
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 )
{
{
return JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
RepositoryGroupService.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
}
protected ProxyConnectorService getProxyConnectorService()
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());
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());
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 );
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 );
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 )
{
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 )
{
CommonServices service =
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
CommonServices.class,
- Collections.singletonList( new JacksonJaxbJsonProvider() ) );
+ Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) );
if ( authzHeader != null )
{
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 );
}
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;
throws Exception
{
CommonServices commonServices = getCommonServices( null );
- assertTrue( commonServices.validateCronExpression( "0 0,30 * * * ?" ) );
+ assertTrue( commonServices.validateCronExpression( "0 0,30 * * * ?" ).isValid() );
}
@Test
throws Exception
{
CommonServices commonServices = getCommonServices( null );
- assertFalse( commonServices.validateCronExpression( "0,30 * * * ?" ) );
+ assertFalse( commonServices.validateCronExpression( "0,30 * * * ?" ).isValid() );
}
}
// 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 );
import org.junit.Test;
import java.nio.file.Path;
-import java.nio.file.Paths;
/**
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;
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;
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;
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() );
}
repositoriesService.scanRepositoryDirectoriesNow( testRepoId );
int timeout = 20000;
- while ( timeout > 0 && repositoriesService.alreadyScanning( testRepoId ) )
+ while ( timeout > 0 && repositoriesService.getScanStatus( testRepoId ).isAlreadyScanning() )
{
Thread.sleep( 500 );
timeout -= 500;
service.addRemoteRepository(getRemoteRepository());
- assertTrue(service.checkRemoteConnectivity("id-new"));
+ assertTrue(service.checkRemoteConnectivity("id-new").isSuccess());
} finally {
removeRemoteRepositories("id-new");
}
service.addRemoteRepository(getRemoteMavenRepository());
- assertTrue(service.checkRemoteConnectivity("id-maven1"));
+ assertTrue(service.checkRemoteConnectivity("id-maven1").isSuccess());
} finally {
removeRemoteRepositories("id-maven1");
}
service.addRemoteRepository(getRemoteOracleRepository());
- assertTrue(service.checkRemoteConnectivity("id-oracle"));
+ assertTrue(service.checkRemoteConnectivity("id-oracle").isSuccess());
} finally {
removeRemoteRepositories("id-oracle");
}
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;
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;
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 )
{
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService( authorizationHeader );
- assertTrue( repositoriesService.isAuthorizedToDeleteArtifacts( managedRepository.getId() ) );
+ assertTrue( repositoriesService.getPermissionStatus( managedRepository.getId() ).isAuthorizedToDeleteArtifacts() );
}
finally
{
{
getManagedRepositoriesService( authorizationHeader ).addManagedRepository( managedRepository );
RepositoriesService repositoriesService = getRepositoriesService( );
- assertFalse( repositoriesService.isAuthorizedToDeleteArtifacts( managedRepository.getId() ) );
+ assertFalse( repositoriesService.getPermissionStatus( managedRepository.getId() ).isAuthorizedToDeleteArtifacts() );
}
finally
{
<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"/>
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Locale;
/**
// 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;
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;
// 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;
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;
// 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;
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;
service.addRemoteRepository( repo );
- assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
+ assertThat( service.checkRemoteConnectivity( repo.getId() ).isSuccess() ).isTrue();
}
finally
{
service.addRemoteRepository( repo );
- assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isTrue();
+ assertThat( service.checkRemoteConnectivity( repo.getId() ).isSuccess() ).isTrue();
}
finally
{
service.addRemoteRepository( repo );
- assertThat( service.checkRemoteConnectivity( repo.getId() ) ).isFalse();
+ assertThat( service.checkRemoteConnectivity( repo.getId() ).isSuccess() ).isFalse();
}
finally
{
<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>