Feature/acs 2147 add get storage object props in content store (#769)

* ACS-2147: initial idea for adding storage properties to ContentStore.

* ACS-2147: adding implementations to ContentStore children + some static analysis cleanup.

* ACS-2147: adding javadoc and small fixes to ObjectStorageProps.

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* ACS-2147: initial idea for adding storage properties to ContentStore.

* ACS-2147: adding implementations to ContentStore children + some static analysis cleanup.

* ACS-2147: adding javadoc and small fixes to ObjectStorageProps.

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* ACS-2147: Adding unit tests and changes after first round of code review.

* ACS-2147: initial idea for adding storage properties to ContentStore.

* ACS-2147: adding implementations to ContentStore children + some static analysis cleanup.

* ACS-2147: adding javadoc and small fixes to ObjectStorageProps.

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* ACS-2147: Adding unit tests and changes after first round of code review.

* ACS-2147: adding implementations to ContentStore children + some static analysis cleanup.

* License header update

Co-authored-by: David Edwards <david.edwards@alfresco.com>

* ACS-2147: Fixes after reverting some 'boy scout' refactor.

* ACS-2147: Rephrasing Alfresco-derived storage properties.

* ACS-2147: Reverting some 'boy scout' refactor.

* ACS-2147: Renaming enum values.

* ACS-2147: Removing wildcard import.

Co-authored-by: David Edwards <david.edwards@alfresco.com>
This commit is contained in:
mpichura
2021-10-25 09:47:36 +02:00
committed by GitHub
parent 4fa0157594
commit 1b0ddb1e74
7 changed files with 284 additions and 49 deletions

View File

@@ -26,6 +26,7 @@
package org.alfresco.repo.content;
import org.alfresco.api.AlfrescoPublicApi;
import org.alfresco.service.Experimental;
import org.alfresco.service.cmr.repository.ContentAccessor;
import org.alfresco.service.cmr.repository.ContentIOException;
import org.alfresco.service.cmr.repository.ContentReader;
@@ -33,6 +34,9 @@ import org.alfresco.service.cmr.repository.ContentStreamListener;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.DirectAccessUrl;
import java.util.Collections;
import java.util.Map;
/**
* Provides low-level retrieval of content
@@ -324,4 +328,20 @@ public interface ContentStore
throw new UnsupportedOperationException(
"Retrieving direct access URLs is not supported by this content store.");
}
/**
* Gets a key-value (String-String) collection of storage headers/properties with their respective values.
* A particular Cloud Connector will fill in that data with Cloud Storage Provider generic data.
* Map may be also filled in with entries consisting of pre-defined Alfresco keys of {@code ObjectStorageProps} and their values.
* If empty Map is returned - no connector is present or connector is not supporting retrieval of the properties
* or cannot determine the properties.
*
* @param contentUrl the URL of the content for which the storage properties are to be retrieved.
* @return Returns a key-value (String-String) collection of storage headers/properties with their respective values.
*/
@Experimental
default Map<String, String> getObjectStorageProperties(String contentUrl)
{
return Collections.emptyMap();
}
}

View File

@@ -0,0 +1,64 @@
/*
* #%L
* Alfresco Data model classes
* %%
* 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 "header" values for Alfresco derived Storage Properties
* Values of this enum should be used when adding Alfresco derived key-value pairs in Storage Properties map.
* Subject to expand/change.
*
* @author mpichura
*/
@Experimental
public enum ObjectStorageProps {
/**
* Object's content is archived and not immediately accessible.
*/
X_ALF_ARCHIVED("x-alf-archived"),
/**
* Object's content retrieval from archive is in progress
*/
X_ALF_ARCHIVE_RESTORE_IN_PROGRESS("x-alf-archive-restore-in-progress"),
/**
* Expiry date and time of object's content retrieved from archive.
* Use YYYYMMDDThhmmssZ (ISO-8601) datetime format when using this value as key in Storage Properties map.
*/
X_ALF_ARCHIVE_RESTORE_EXPIRY("x-alf-archive-restore-expiry");
ObjectStorageProps(String value) {
this.value = value;
}
private final String value;
public String getValue() {
return value;
}
}