added payload backend to folder

This commit is contained in:
Lucio Lelii 2021-11-26 17:17:37 +01:00
parent 8b64b3ed06
commit 7aff397939
8 changed files with 51 additions and 23 deletions

View File

@ -6,6 +6,6 @@ public class Constants {
public static final String versionPrefix = "_v"; public static final String versionPrefix = "_v";
public static final String mongoStorageConstant = "gcube-mongo"; public static final String mongoStorageConstant = "gcube-mongo";
public static final String s3StorageConstant = "gcube-s3";
} }

View File

@ -22,12 +22,14 @@ public class NodeConstants {
public static final String LASTACTION = "hl:lastAction"; public static final String LASTACTION = "hl:lastAction";
public static final String HIDDEN = "hl:hidden"; public static final String HIDDEN = "hl:hidden";
public static final String EXTERNALFOLDERPLUGIN ="hl:pluginName"; public static final String PAYLOADBACKEND ="hl:payloadBackend";
public static final String SHAREDFOLDERPRIVILEGE = "hl:privilege"; public static final String SHAREDFOLDERPRIVILEGE = "hl:privilege";
public static final String VREFOLDERCHECK = "hl:isVreFolder"; public static final String VREFOLDERCHECK = "hl:isVreFolder";
public static final String DISPLAYNAME = "hl:displayName"; public static final String DISPLAYNAME = "hl:displayName";
public static final String UNIQUEID = "hl:uuid"; public static final String UNIQUEID = "hl:uuid";
public static final String PARAMETERS = "hl:parameters";
public static final String CONTENTSIZE = "hl:size"; public static final String CONTENTSIZE = "hl:size";
public static final String CONTENTDATA ="jcr:data"; public static final String CONTENTDATA ="jcr:data";
@ -42,4 +44,5 @@ public class NodeConstants {
public static final String OWNERNODETYPE = "nthl:user"; public static final String OWNERNODETYPE = "nthl:user";
public static final String GENERICFILETYPE = "nthl:externalFile"; public static final String GENERICFILETYPE = "nthl:externalFile";
public static final String CONTENTFILETYPE = "nthl:file"; public static final String CONTENTFILETYPE = "nthl:file";
public static final String PAYLOADBACKENDTYPE = "nthl:payloadbackend";
} }

View File

@ -1,14 +1,7 @@
package org.gcube.common.storagehub.model.items; package org.gcube.common.storagehub.model.items;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import org.gcube.common.storagehub.model.annotations.RootNode; import org.gcube.common.storagehub.model.annotations.RootNode;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
@ -19,10 +12,4 @@ import lombok.Setter;
@RootNode("nthl:externalFolder") @RootNode("nthl:externalFolder")
public class ExternalFolder extends FolderItem { public class ExternalFolder extends FolderItem {
@Attribute(EXTERNALFOLDERPLUGIN)
String managedBy;
@JsonIgnore
@NodeAttribute(value=PARAMETERS_NAME)
Metadata connectionParameters = new Metadata();
} }

View File

@ -1,14 +1,22 @@
package org.gcube.common.storagehub.model.items; package org.gcube.common.storagehub.model.items;
import static org.gcube.common.storagehub.model.NodeConstants.PAYLOADBACKEND;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.RootNode; import org.gcube.common.storagehub.model.annotations.RootNode;
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor @NoArgsConstructor
@RootNode("nthl:workspaceItem") @RootNode("nthl:workspaceItem")
public class FolderItem extends Item { public class FolderItem extends Item {
@Attribute(PAYLOADBACKEND)
PayloadBackend backend;
} }

View File

@ -0,0 +1,23 @@
package org.gcube.common.storagehub.model.items.nodes;
import static org.gcube.common.storagehub.model.NodeConstants.*;
import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.annotations.Attribute;
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.NoArgsConstructor;
@NoArgsConstructor
@Data
@AttributeRootNode(PAYLOADBACKENDTYPE)
public class PayloadBackend {
@Attribute(STORAGENAME)
String storageName;
@JsonIgnore
@NodeAttribute(value=PARAMETERS)
Metadata parameters = new Metadata();
}

View File

@ -1,8 +1,12 @@
package org.gcube.common.storagehub.model.storages; package org.gcube.common.storagehub.model.storages;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
@Data @Data
@AllArgsConstructor
@NoArgsConstructor
public class MetaInfo { public class MetaInfo {
long size; long size;

View File

@ -2,18 +2,17 @@ package org.gcube.common.storagehub.model.storages;
import java.io.InputStream; import java.io.InputStream;
import org.gcube.common.storagehub.model.items.AbstractFileItem;
import org.gcube.common.storagehub.model.items.nodes.Content; import org.gcube.common.storagehub.model.items.nodes.Content;
public interface StorageBackend { public interface StorageBackend {
String getName(); String getName();
String onCopy(AbstractFileItem item); MetaInfo onCopy(Content content, String newParentPath, String newName);
String onMove(AbstractFileItem item); MetaInfo onMove(Content content, String newParentPath);
void onDelete(Content id); void onDelete(Content content);
MetaInfo upload(InputStream stream, String relativePath, String name); MetaInfo upload(InputStream stream, String relativePath, String name);

View File

@ -1,9 +1,13 @@
package org.gcube.common.storagehub.model.storages; package org.gcube.common.storagehub.model.storages;
public interface StorageBackendFactory<S extends StorageBackend> { import org.gcube.common.storagehub.model.Metadata;
import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters;
public interface StorageBackendFactory {
String getName(); String getName();
S create(String parameter); StorageBackend create(Metadata parameter) throws InvalidCallParameters;
} }