ACS-2200: Java API for archive/archive-restore content (#825)

* ACS-2200: Java API for archive/archive-restore content + unit tests.

* Bump restapi from 1.64 to 1.65 (#795)

* Bump utility from 3.0.45 to 3.0.47 (#794)

* ACS-2200: Applying review comments.

* ACS-2200: Applying review comments.

* ACS-2200: Adding new unit test to suite.

* ACS-2200: Adding optional archive params to archive operation.

* Bump restapi from 1.64 to 1.65 (#795)

* Bump utility from 3.0.45 to 3.0.47 (#794)

* ACS-2200: Applying review comments.

* ACS-2200: Java API for archive/archive-restore content + unit tests.
This commit is contained in:
mpichura
2021-12-08 16:33:20 +01:00
committed by GitHub
parent 8862645dea
commit 4f1397eeee
14 changed files with 773 additions and 100 deletions

View File

@@ -0,0 +1,49 @@
/*
* #%L
* Alfresco Remote API
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.repo.content;
import org.alfresco.service.Experimental;
/**
* Enumeration with values for archive-restore parameter keys.
* Values of this enum should be used as keys when requesting for content restore from archive.
* Subject to expand/change.
*
* @author mpichura
*/
@Experimental
public enum ContentRestoreParams
{
/**
* Restore expiry in days. Corresponding value should be integer.
*/
EXPIRY_DAYS,
/**
* Priority for restore from archive. Corresponding value should one of Standard/High
*/
RESTORE_PRIORITY
}

View File

@@ -34,6 +34,7 @@ import org.alfresco.service.cmr.repository.ContentStreamListener;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.DirectAccessUrl;
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
@@ -344,4 +345,41 @@ public interface ContentStore
{
return Collections.emptyMap();
}
/**
* Submit a request to send content to archive (offline) state.
* If no connector is present or connector is not supporting sending to archive, then {@link UnsupportedOperationException} will be returned.
* Specific connector will decide which storage class/tier will be set for content.
* This method is experimental and subject to changes.
*
* @param contentUrl the URL of the content which is to be archived.
* @param archiveParams a map of String-Serializable parameters defining Storage Provider specific request parameters (can be empty).
* @return true when request successful, false when unsuccessful.
* @throws UnsupportedOperationException when store is unable to handle request.
*/
@Experimental
default boolean requestSendContentToArchive(String contentUrl, Map<String, Serializable> archiveParams)
{
throw new UnsupportedOperationException("Request to archive content is not supported by this content store.");
}
/**
* Submit a request to restore content from archive (offline) state.
* If no connector is present or connector is not supporting restoring fom archive, then {@link UnsupportedOperationException} will be returned.
* One of input parameters of this method is a map (String-Serializable) of Storage Provider specific input needed to perform proper restore.
* Keys of this map should be restricted to {@code ContentRestoreParams} enumeration.
* For AWS S3 map can indicating expiry days, Glacier restore tier.
* For Azure Blob map can indicate rehydrate priority.
* This method is experimental and subject to changes.
*
* @param contentUrl the URL of the content which is to be archived.
* @param restoreParams a map of String-Serializable parameters defining Storage Provider specific request parameters (can be empty).
* @return true when request successful, false when unsuccessful.
* @throws UnsupportedOperationException when store is unable to handle request.
*/
@Experimental
default boolean requestRestoreContentFromArchive(String contentUrl, Map<String, Serializable> restoreParams)
{
throw new UnsupportedOperationException("Request to restore content from archive is not supported by this content store.");
}
}