Compare commits
14 Commits
master
...
multipleSt
Author | SHA1 | Date |
---|---|---|
lucio | 8e90fb4a90 | |
Lucio Lelii | 545ad3160a | |
Lucio Lelii | 2fbc0f8ef7 | |
Lucio Lelii | 62c06a0633 | |
Lucio Lelii | bc25fa9f33 | |
Lucio Lelii | 18a51aa0e3 | |
Lucio Lelii | a4012a2504 | |
Lucio Lelii | 0158898abf | |
Lucio Lelii | e1d8700d6a | |
Lucio Lelii | 701283e5a2 | |
Lucio Lelii | 74b78a1e5d | |
Lucio Lelii | 7aff397939 | |
Lucio Lelii | 8b64b3ed06 | |
lucio.lelii | 3fad462d88 |
|
@ -3,6 +3,8 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v2.0.0-SNAPSHOT] - [2023-02-25]
|
||||
|
||||
## [v1.1.1] - [2021-09-28]
|
||||
|
||||
- solved bug on externalManaged field
|
||||
|
|
23
pom.xml
23
pom.xml
|
@ -18,7 +18,7 @@
|
|||
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>storagehub-model</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>storagehub-model</name>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -35,20 +35,16 @@
|
|||
|
||||
<properties>
|
||||
<jackson.version>2.8.11</jackson.version>
|
||||
<lombok.version>1.18.4</lombok.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.14.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-clients</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
|
@ -74,15 +70,4 @@
|
|||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<target>1.8</target>
|
||||
<source>1.8</source>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -3,6 +3,12 @@ package org.gcube.common.storagehub.model;
|
|||
public class Constants {
|
||||
|
||||
public static final String enchriptedPrefix = "E_";
|
||||
public static final String enchriptedVolatile = "VLT_";
|
||||
|
||||
public static final String versionPrefix = "_v";
|
||||
public static final String MONGO_STORAGE = "gcube-mongo";
|
||||
|
||||
public static final String DEFAULT_S3_STORAGE = "default-gcube-s3";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,11 +9,13 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class Metadata {
|
||||
|
||||
@MapAttribute(excludeStartWith="jcr:")
|
||||
|
|
|
@ -10,4 +10,39 @@ public class NodeConstants {
|
|||
public static final String USERS_NAME ="hl:users";
|
||||
public static final String EXTERNALREPOSITORY_NAME ="hl:externalRepository";
|
||||
public static final String PROPERTY_NAME ="hl:property";
|
||||
|
||||
|
||||
public static final String PUBLIC = "hl:isPublic";
|
||||
public static final String TITLE ="jcr:title";
|
||||
public static final String DESCRIPTION = "jcr:description";
|
||||
public static final String LASTMODIFIEDBY = "jcr:lastModifiedBy";
|
||||
public static final String LASTMODIFIEDTIME = "jcr:lastModified";
|
||||
public static final String CREATEDTIME = "jcr:created";
|
||||
public static final String PORTALLOGIN = "hl:portalLogin";
|
||||
public static final String LASTACTION = "hl:lastAction";
|
||||
public static final String HIDDEN = "hl:hidden";
|
||||
|
||||
public static final String PAYLOADBACKEND ="hl:payloadBackend";
|
||||
|
||||
public static final String SHAREDFOLDERPRIVILEGE = "hl:privilege";
|
||||
public static final String VREFOLDERCHECK = "hl:isVreFolder";
|
||||
public static final String DISPLAYNAME = "hl:displayName";
|
||||
|
||||
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 CONTENTDATA ="jcr:data";
|
||||
public static final String CONTENTREMOTEPATH = "hl:remotePath";
|
||||
public static final String CONTENTMYMETYPE = "jcr:mimeType";
|
||||
public static final String CONTENTID = "hl:storageId";
|
||||
public static final String STORAGENAME = "hl:storageName";
|
||||
|
||||
//TYPE
|
||||
public static final String SHAREDFOLDERTYPE = "nthl:workspaceSharedItem";
|
||||
public static final String MESSAGETYPE = "nthl:itemSentRequest";
|
||||
public static final String OWNERNODETYPE = "nthl:user";
|
||||
public static final String GENERICFILETYPE = "nthl:externalFile";
|
||||
public static final String CONTENTFILETYPE = "nthl:file";
|
||||
public static final String PAYLOADBACKENDTYPE = "nthl:payloadBackend";
|
||||
}
|
||||
|
|
|
@ -11,4 +11,5 @@ public @interface Attribute {
|
|||
|
||||
String value();
|
||||
boolean isReadOnly() default false;
|
||||
String defaultValue() default "";
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@ import java.lang.annotation.Target;
|
|||
@Target(ElementType.TYPE)
|
||||
public @interface RootNode {
|
||||
|
||||
String value();
|
||||
String[] value();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class BackendGenericError extends StorageHubException{
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class IdNotFoundException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class InvalidCallParameters extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class InvalidItemException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class ItemAlreadyExistsException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class ItemLockedException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class PluginInitializationException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class PluginNotFoundException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public abstract class StorageHubException extends Exception {
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
public class StorageIdNotFoundException extends StorageHubException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7225259271771357699L;
|
||||
|
||||
public StorageIdNotFoundException(String id, String storageName, Throwable cause) {
|
||||
super(String.format("id %s not found in %s", id, storageName), cause);
|
||||
}
|
||||
|
||||
public StorageIdNotFoundException(String id, String storageName) {
|
||||
super(String.format("id %s not found in %s", id, storageName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 404;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,5 @@
|
|||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class UserNotAuthorizedException extends StorageHubException {
|
||||
|
||||
/**
|
||||
|
@ -37,7 +34,7 @@ public class UserNotAuthorizedException extends StorageHubException {
|
|||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 500;
|
||||
return 401;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,7 @@
|
|||
package org.gcube.common.storagehub.model.items;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PARAMETERS_NAME;
|
||||
|
||||
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 com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
@ -19,10 +12,5 @@ import lombok.Setter;
|
|||
@RootNode("nthl:externalFolder")
|
||||
public class ExternalFolder extends FolderItem {
|
||||
|
||||
@Attribute("hl:pluginName")
|
||||
String managedBy;
|
||||
|
||||
@JsonIgnore
|
||||
@NodeAttribute(value=PARAMETERS_NAME)
|
||||
Metadata connectionParameters = new Metadata();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import lombok.Setter;
|
|||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@RootNode("nthl:ExternalLink")
|
||||
@RootNode({"nthl:externalLink","nthl:ExternalLink"})
|
||||
public class ExternalLink extends Item{
|
||||
|
||||
@Attribute("hl:value")
|
||||
|
|
|
@ -1,14 +1,23 @@
|
|||
package org.gcube.common.storagehub.model.items;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PAYLOADBACKEND;
|
||||
|
||||
import org.gcube.common.storagehub.model.Constants;
|
||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
||||
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.Setter;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@RootNode("nthl:workspaceItem")
|
||||
public class FolderItem extends Item {
|
||||
|
||||
|
||||
|
||||
@NodeAttribute(value= PAYLOADBACKEND)
|
||||
PayloadBackend backend = new PayloadBackend(Constants.DEFAULT_S3_STORAGE, null);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.common.storagehub.model.items;
|
||||
|
||||
import org.gcube.common.storagehub.model.NodeConstants;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
||||
import org.gcube.common.storagehub.model.annotations.RootNode;
|
||||
import org.gcube.common.storagehub.model.items.nodes.Content;
|
||||
|
@ -14,12 +14,12 @@ import lombok.Setter;
|
|||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@RootNode("nthl:externalFile")
|
||||
@RootNode(GENERICFILETYPE)
|
||||
public class GenericFileItem extends AbstractFileItem{
|
||||
|
||||
|
||||
|
||||
@NodeAttribute(value =NodeConstants.CONTENT_NAME)
|
||||
@NodeAttribute(value =CONTENT_NAME)
|
||||
Content content;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
package org.gcube.common.storagehub.model.items;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.ACCOUNTING_NAME;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CREATEDTIME;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.DESCRIPTION;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.HIDDEN;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.LASTACTION;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.LASTMODIFIEDBY;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.LASTMODIFIEDTIME;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.METADATA_NAME;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_NAME;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PORTALLOGIN;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PUBLIC;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.TITLE;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
@ -13,7 +22,6 @@ import org.gcube.common.storagehub.model.items.nodes.Accounting;
|
|||
import org.gcube.common.storagehub.model.items.nodes.Owner;
|
||||
import org.gcube.common.storagehub.model.types.ItemAction;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.Getter;
|
||||
|
@ -28,39 +36,37 @@ public class Item extends RootItem{
|
|||
|
||||
boolean trashed;
|
||||
|
||||
//TODO: remove on next release
|
||||
@JsonIgnore
|
||||
boolean externalManaged = false;
|
||||
|
||||
boolean shared;
|
||||
|
||||
boolean locked;
|
||||
|
||||
@Attribute("hl:isPublic")
|
||||
@Attribute(PUBLIC)
|
||||
boolean publicItem;
|
||||
|
||||
@Attribute(value ="jcr:title")
|
||||
@Attribute(TITLE)
|
||||
String title;
|
||||
|
||||
@Attribute("jcr:description")
|
||||
@Attribute(DESCRIPTION)
|
||||
String description;
|
||||
|
||||
@Attribute("jcr:lastModifiedBy")
|
||||
@Attribute(LASTMODIFIEDBY)
|
||||
String lastModifiedBy;
|
||||
|
||||
@Attribute("jcr:lastModified")
|
||||
@Attribute(LASTMODIFIEDTIME)
|
||||
Calendar lastModificationTime;
|
||||
|
||||
@Attribute(value = "jcr:created", isReadOnly=true)
|
||||
@Attribute(value = CREATEDTIME, isReadOnly=true)
|
||||
Calendar creationTime;
|
||||
|
||||
@Attribute("hl:portalLogin")
|
||||
@Attribute(PORTALLOGIN)
|
||||
String owner;
|
||||
|
||||
@Attribute("hl:lastAction")
|
||||
@Attribute(LASTACTION)
|
||||
ItemAction lastAction;
|
||||
|
||||
@Attribute("hl:hidden")
|
||||
@Attribute(HIDDEN)
|
||||
boolean hidden;
|
||||
|
||||
@NodeAttribute(value=OWNER_NAME, isReadOnly=true)
|
||||
|
|
|
@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.Setter;
|
||||
|
||||
import org.gcube.common.storagehub.model.Metadata;
|
||||
import org.gcube.common.storagehub.model.NodeConstants;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
||||
import org.gcube.common.storagehub.model.annotations.Attribute;
|
||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
||||
import org.gcube.common.storagehub.model.annotations.RootNode;
|
||||
|
@ -13,19 +13,19 @@ import org.gcube.common.storagehub.model.annotations.RootNode;
|
|||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@RootNode("nthl:workspaceSharedItem")
|
||||
@RootNode(SHAREDFOLDERTYPE)
|
||||
public class SharedFolder extends FolderItem {
|
||||
|
||||
@Attribute("hl:privilege")
|
||||
@Attribute(SHAREDFOLDERPRIVILEGE)
|
||||
String privilege;
|
||||
|
||||
@Attribute("hl:isVreFolder")
|
||||
@Attribute(VREFOLDERCHECK)
|
||||
boolean vreFolder;
|
||||
|
||||
@Attribute("hl:displayName")
|
||||
@Attribute(DISPLAYNAME)
|
||||
String displayName;
|
||||
|
||||
@NodeAttribute(NodeConstants.USERS_NAME)
|
||||
@NodeAttribute(USERS_NAME)
|
||||
Metadata users;
|
||||
|
||||
/* @NodeAttribute("hl:members")
|
||||
|
|
|
@ -1,10 +1,21 @@
|
|||
package org.gcube.common.storagehub.model.items.nodes;
|
||||
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTDATA;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTFILETYPE;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTID;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTMYMETYPE;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTREMOTEPATH;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.CONTENTSIZE;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PAYLOADBACKEND;
|
||||
|
||||
import org.gcube.common.storagehub.model.Constants;
|
||||
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
@ -12,26 +23,32 @@ import lombok.Setter;
|
|||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@AttributeRootNode(value="nthl:file")
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@AttributeRootNode(CONTENTFILETYPE)
|
||||
public class Content {
|
||||
|
||||
@Attribute("hl:size")
|
||||
@Attribute(CONTENTSIZE)
|
||||
Long size;
|
||||
|
||||
@Attribute("jcr:data")
|
||||
@Attribute(CONTENTDATA)
|
||||
String data;
|
||||
|
||||
@Attribute("hl:remotePath")
|
||||
@Attribute(CONTENTREMOTEPATH)
|
||||
String remotePath;
|
||||
|
||||
@Attribute("jcr:mimeType")
|
||||
@Attribute(CONTENTMYMETYPE)
|
||||
String mimeType;
|
||||
|
||||
@Attribute("hl:storageId")
|
||||
@Attribute(CONTENTID)
|
||||
String storageId;
|
||||
|
||||
@NodeAttribute(value= PAYLOADBACKEND)
|
||||
PayloadBackend payloadBackend;
|
||||
|
||||
@JsonIgnore
|
||||
@Attribute("hl:storageName")
|
||||
String managedBy;
|
||||
public PayloadBackend getPayloadBackend(){
|
||||
if(payloadBackend == null)
|
||||
return new PayloadBackend(Constants.MONGO_STORAGE, null);
|
||||
else return payloadBackend;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.common.storagehub.model.items.nodes;
|
|||
|
||||
import org.gcube.common.storagehub.model.annotations.Attribute;
|
||||
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -12,12 +12,12 @@ import lombok.Setter;
|
|||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@AttributeRootNode(value="nthl:user")
|
||||
@AttributeRootNode(OWNERNODETYPE)
|
||||
public class Owner {
|
||||
|
||||
@Attribute("hl:portalLogin")
|
||||
@Attribute(PORTALLOGIN)
|
||||
String userName;
|
||||
|
||||
@Attribute("hl:uuid")
|
||||
@Attribute(UNIQUEID)
|
||||
String userId;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.common.storagehub.model.items.nodes;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PARAMETERS;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.PAYLOADBACKENDTYPE;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.STORAGENAME;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
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.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AttributeRootNode(PAYLOADBACKENDTYPE)
|
||||
public class PayloadBackend {
|
||||
|
||||
@Attribute(value= STORAGENAME)
|
||||
private String storageName;
|
||||
|
||||
@JsonIgnore
|
||||
@NodeAttribute(value=PARAMETERS)
|
||||
private Metadata parameters = new Metadata();
|
||||
|
||||
public String getStorageName() {
|
||||
return storageName;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Map<String, Object> getParameters(){
|
||||
if (parameters ==null || parameters.getMap() == null )
|
||||
return Collections.emptyMap();
|
||||
else return parameters.getMap();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.common.storagehub.model.messages;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_NAME;
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
@ -17,7 +17,7 @@ import lombok.Setter;
|
|||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@RootNode("nthl:itemSentRequest")
|
||||
@RootNode(MESSAGETYPE)
|
||||
public class Message extends RootItem{
|
||||
|
||||
boolean withAttachments;
|
||||
|
|
|
@ -4,5 +4,5 @@ import java.util.Map;
|
|||
|
||||
public interface PluginParameters {
|
||||
|
||||
Map<String, String> getParameters();
|
||||
Map<String, Object> getParameters();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package org.gcube.common.storagehub.model.storages;
|
||||
|
||||
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class MetaInfo {
|
||||
|
||||
long size;
|
||||
|
@ -10,4 +16,6 @@ public class MetaInfo {
|
|||
String storageId;
|
||||
|
||||
String remotePath;
|
||||
|
||||
PayloadBackend payloadBackend;
|
||||
}
|
||||
|
|
|
@ -1,27 +1,81 @@
|
|||
package org.gcube.common.storagehub.model.storages;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||
import org.gcube.common.storagehub.model.exceptions.StorageIdNotFoundException;
|
||||
import org.gcube.common.storagehub.model.items.nodes.Content;
|
||||
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
|
||||
|
||||
public interface StorageBackend {
|
||||
public abstract class StorageBackend {
|
||||
|
||||
String getName();
|
||||
private PayloadBackend payloadConfiguration;
|
||||
|
||||
String onCopy(AbstractFileItem item);
|
||||
public StorageBackend(PayloadBackend payloadConfiguration) {
|
||||
this.payloadConfiguration = payloadConfiguration;
|
||||
}
|
||||
|
||||
String onMove(AbstractFileItem item);
|
||||
|
||||
void onDelete(Content id);
|
||||
public PayloadBackend getPayloadConfiguration() {
|
||||
return payloadConfiguration;
|
||||
}
|
||||
|
||||
MetaInfo upload(InputStream stream, String relativePath, String name);
|
||||
protected void setPayloadConfiguration(PayloadBackend payloadConfiguration) {
|
||||
this.payloadConfiguration = payloadConfiguration;
|
||||
}
|
||||
|
||||
|
||||
public abstract MetaInfo onCopy(Content content, String newParentPath, String newName);
|
||||
|
||||
InputStream download(Content item);
|
||||
public abstract MetaInfo onMove(Content content, String newParentPath);
|
||||
|
||||
//public abstract void onDelete(Content content);
|
||||
|
||||
public abstract void delete(String id);
|
||||
|
||||
public abstract MetaInfo upload(InputStream stream, String relativePath, String name, String user);
|
||||
|
||||
public abstract MetaInfo upload(InputStream stream, String relativePath, String name, Long size, String user);
|
||||
|
||||
public abstract InputStream download(Content item) throws StorageIdNotFoundException;
|
||||
|
||||
public abstract InputStream download(String id) throws StorageIdNotFoundException;
|
||||
|
||||
public abstract Map<String, String> getFileMetadata(String id);
|
||||
|
||||
public abstract MetaInfo upload(InputStream stream, String relativePath, String name, String storageId, Long size, String user);
|
||||
|
||||
@Deprecated
|
||||
String getTotalSizeStored();
|
||||
public abstract String getTotalSizeStored();
|
||||
@Deprecated
|
||||
String getTotalItemsCount();
|
||||
public abstract String getTotalItemsCount();
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((payloadConfiguration == null) ? 0 : payloadConfiguration.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
StorageBackend other = (StorageBackend) obj;
|
||||
if (payloadConfiguration == null) {
|
||||
if (other.payloadConfiguration != null)
|
||||
return false;
|
||||
} else if (!payloadConfiguration.equals(other.payloadConfiguration))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package org.gcube.common.storagehub.model.storages;
|
||||
|
||||
public interface StorageBackendFactory<S extends StorageBackend> {
|
||||
import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters;
|
||||
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
|
||||
|
||||
public interface StorageBackendFactory {
|
||||
|
||||
String getName();
|
||||
|
||||
S create(String parameter);
|
||||
default boolean isSystemStorage() {
|
||||
return false;
|
||||
}
|
||||
|
||||
StorageBackend create(PayloadBackend payloadConfiguration) throws InvalidCallParameters;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package org.gcube.common.storagehub.model.storages;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class StorageDescriptor {
|
||||
|
||||
String name;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package org.gcube.common.storagehub.model.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class SHUBUser implements Comparable<SHUBUser> {
|
||||
|
||||
private String userName;
|
||||
private long homeVersion;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
SHUBUser other = (SHUBUser) obj;
|
||||
if (userName == null) {
|
||||
if (other.userName != null)
|
||||
return false;
|
||||
} else if (!userName.equals(other.userName))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((userName == null) ? 0 : userName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(SHUBUser user) {
|
||||
return userName.compareTo(user.getUserName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue