Compare commits
No commits in common. "multipleStorageBackend" and "master" have entirely different histories.
multipleSt
...
master
|
@ -3,8 +3,6 @@
|
||||||
All notable changes to this project will be documented in this file.
|
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).
|
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]
|
## [v1.1.1] - [2021-09-28]
|
||||||
|
|
||||||
- solved bug on externalManaged field
|
- solved bug on externalManaged field
|
||||||
|
|
23
pom.xml
23
pom.xml
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
<artifactId>storagehub-model</artifactId>
|
<artifactId>storagehub-model</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>1.1.1</version>
|
||||||
<name>storagehub-model</name>
|
<name>storagehub-model</name>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>gcube-bom</artifactId>
|
<artifactId>gcube-bom</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>2.0.1</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -35,14 +35,18 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jackson.version>2.8.11</jackson.version>
|
<jackson.version>2.8.11</jackson.version>
|
||||||
<lombok.version>1.18.4</lombok.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<scope>provided</scope>
|
<version>1.14.8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-clients</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -70,4 +74,15 @@
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<target>1.8</target>
|
||||||
|
<source>1.8</source>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -3,12 +3,6 @@ package org.gcube.common.storagehub.model;
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public static final String enchriptedPrefix = "E_";
|
public static final String enchriptedPrefix = "E_";
|
||||||
public static final String enchriptedVolatile = "VLT_";
|
|
||||||
|
|
||||||
public static final String versionPrefix = "_v";
|
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,13 +9,11 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ToString
|
|
||||||
public class Metadata {
|
public class Metadata {
|
||||||
|
|
||||||
@MapAttribute(excludeStartWith="jcr:")
|
@MapAttribute(excludeStartWith="jcr:")
|
||||||
|
|
|
@ -10,39 +10,4 @@ public class NodeConstants {
|
||||||
public static final String USERS_NAME ="hl:users";
|
public static final String USERS_NAME ="hl:users";
|
||||||
public static final String EXTERNALREPOSITORY_NAME ="hl:externalRepository";
|
public static final String EXTERNALREPOSITORY_NAME ="hl:externalRepository";
|
||||||
public static final String PROPERTY_NAME ="hl:property";
|
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,5 +11,4 @@ public @interface Attribute {
|
||||||
|
|
||||||
String value();
|
String value();
|
||||||
boolean isReadOnly() default false;
|
boolean isReadOnly() default false;
|
||||||
String defaultValue() default "";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@ import java.lang.annotation.Target;
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
public @interface RootNode {
|
public @interface RootNode {
|
||||||
|
|
||||||
String[] value();
|
String value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class BackendGenericError extends StorageHubException{
|
public class BackendGenericError extends StorageHubException{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class IdNotFoundException extends StorageHubException {
|
public class IdNotFoundException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class InvalidCallParameters extends StorageHubException {
|
public class InvalidCallParameters extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class InvalidItemException extends StorageHubException {
|
public class InvalidItemException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class ItemAlreadyExistsException extends StorageHubException {
|
public class ItemAlreadyExistsException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class ItemLockedException extends StorageHubException {
|
public class ItemLockedException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class PluginInitializationException extends StorageHubException {
|
public class PluginInitializationException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class PluginNotFoundException extends StorageHubException {
|
public class PluginNotFoundException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public abstract class StorageHubException extends Exception {
|
public abstract class StorageHubException extends Exception {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
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,5 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.exceptions;
|
package org.gcube.common.storagehub.model.exceptions;
|
||||||
|
|
||||||
|
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||||
|
|
||||||
|
@Unrecoverable
|
||||||
public class UserNotAuthorizedException extends StorageHubException {
|
public class UserNotAuthorizedException extends StorageHubException {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +37,7 @@ public class UserNotAuthorizedException extends StorageHubException {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getStatus() {
|
public int getStatus() {
|
||||||
return 401;
|
return 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
package org.gcube.common.storagehub.model.items;
|
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 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;
|
||||||
|
@ -12,5 +19,10 @@ import lombok.Setter;
|
||||||
@RootNode("nthl:externalFolder")
|
@RootNode("nthl:externalFolder")
|
||||||
public class ExternalFolder extends FolderItem {
|
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
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@RootNode({"nthl:externalLink","nthl:ExternalLink"})
|
@RootNode("nthl:ExternalLink")
|
||||||
public class ExternalLink extends Item{
|
public class ExternalLink extends Item{
|
||||||
|
|
||||||
@Attribute("hl:value")
|
@Attribute("hl:value")
|
||||||
|
|
|
@ -1,23 +1,14 @@
|
||||||
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.Constants;
|
|
||||||
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 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 {
|
||||||
|
|
||||||
@NodeAttribute(value= PAYLOADBACKEND)
|
|
||||||
PayloadBackend backend = new PayloadBackend(Constants.DEFAULT_S3_STORAGE, null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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.NodeConstants;
|
||||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
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 org.gcube.common.storagehub.model.items.nodes.Content;
|
import org.gcube.common.storagehub.model.items.nodes.Content;
|
||||||
|
@ -14,12 +14,12 @@ import lombok.Setter;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@RootNode(GENERICFILETYPE)
|
@RootNode("nthl:externalFile")
|
||||||
public class GenericFileItem extends AbstractFileItem{
|
public class GenericFileItem extends AbstractFileItem{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NodeAttribute(value =CONTENT_NAME)
|
@NodeAttribute(value =NodeConstants.CONTENT_NAME)
|
||||||
Content content;
|
Content content;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.items;
|
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.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.METADATA_NAME;
|
||||||
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_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;
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
@ -22,6 +13,7 @@ import org.gcube.common.storagehub.model.items.nodes.Accounting;
|
||||||
import org.gcube.common.storagehub.model.items.nodes.Owner;
|
import org.gcube.common.storagehub.model.items.nodes.Owner;
|
||||||
import org.gcube.common.storagehub.model.types.ItemAction;
|
import org.gcube.common.storagehub.model.types.ItemAction;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
@ -36,37 +28,39 @@ public class Item extends RootItem{
|
||||||
|
|
||||||
boolean trashed;
|
boolean trashed;
|
||||||
|
|
||||||
|
//TODO: remove on next release
|
||||||
|
@JsonIgnore
|
||||||
boolean externalManaged = false;
|
boolean externalManaged = false;
|
||||||
|
|
||||||
boolean shared;
|
boolean shared;
|
||||||
|
|
||||||
boolean locked;
|
boolean locked;
|
||||||
|
|
||||||
@Attribute(PUBLIC)
|
@Attribute("hl:isPublic")
|
||||||
boolean publicItem;
|
boolean publicItem;
|
||||||
|
|
||||||
@Attribute(TITLE)
|
@Attribute(value ="jcr:title")
|
||||||
String title;
|
String title;
|
||||||
|
|
||||||
@Attribute(DESCRIPTION)
|
@Attribute("jcr:description")
|
||||||
String description;
|
String description;
|
||||||
|
|
||||||
@Attribute(LASTMODIFIEDBY)
|
@Attribute("jcr:lastModifiedBy")
|
||||||
String lastModifiedBy;
|
String lastModifiedBy;
|
||||||
|
|
||||||
@Attribute(LASTMODIFIEDTIME)
|
@Attribute("jcr:lastModified")
|
||||||
Calendar lastModificationTime;
|
Calendar lastModificationTime;
|
||||||
|
|
||||||
@Attribute(value = CREATEDTIME, isReadOnly=true)
|
@Attribute(value = "jcr:created", isReadOnly=true)
|
||||||
Calendar creationTime;
|
Calendar creationTime;
|
||||||
|
|
||||||
@Attribute(PORTALLOGIN)
|
@Attribute("hl:portalLogin")
|
||||||
String owner;
|
String owner;
|
||||||
|
|
||||||
@Attribute(LASTACTION)
|
@Attribute("hl:lastAction")
|
||||||
ItemAction lastAction;
|
ItemAction lastAction;
|
||||||
|
|
||||||
@Attribute(HIDDEN)
|
@Attribute("hl:hidden")
|
||||||
boolean hidden;
|
boolean hidden;
|
||||||
|
|
||||||
@NodeAttribute(value=OWNER_NAME, isReadOnly=true)
|
@NodeAttribute(value=OWNER_NAME, isReadOnly=true)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import org.gcube.common.storagehub.model.Metadata;
|
import org.gcube.common.storagehub.model.Metadata;
|
||||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
import org.gcube.common.storagehub.model.NodeConstants;
|
||||||
import org.gcube.common.storagehub.model.annotations.Attribute;
|
import org.gcube.common.storagehub.model.annotations.Attribute;
|
||||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
||||||
import org.gcube.common.storagehub.model.annotations.RootNode;
|
import org.gcube.common.storagehub.model.annotations.RootNode;
|
||||||
|
@ -13,19 +13,19 @@ import org.gcube.common.storagehub.model.annotations.RootNode;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@RootNode(SHAREDFOLDERTYPE)
|
@RootNode("nthl:workspaceSharedItem")
|
||||||
public class SharedFolder extends FolderItem {
|
public class SharedFolder extends FolderItem {
|
||||||
|
|
||||||
@Attribute(SHAREDFOLDERPRIVILEGE)
|
@Attribute("hl:privilege")
|
||||||
String privilege;
|
String privilege;
|
||||||
|
|
||||||
@Attribute(VREFOLDERCHECK)
|
@Attribute("hl:isVreFolder")
|
||||||
boolean vreFolder;
|
boolean vreFolder;
|
||||||
|
|
||||||
@Attribute(DISPLAYNAME)
|
@Attribute("hl:displayName")
|
||||||
String displayName;
|
String displayName;
|
||||||
|
|
||||||
@NodeAttribute(USERS_NAME)
|
@NodeAttribute(NodeConstants.USERS_NAME)
|
||||||
Metadata users;
|
Metadata users;
|
||||||
|
|
||||||
/* @NodeAttribute("hl:members")
|
/* @NodeAttribute("hl:members")
|
||||||
|
|
|
@ -1,21 +1,10 @@
|
||||||
package org.gcube.common.storagehub.model.items.nodes;
|
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.Attribute;
|
||||||
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
|
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
|
||||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -23,32 +12,26 @@ import lombok.Setter;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@AllArgsConstructor
|
||||||
@AttributeRootNode(CONTENTFILETYPE)
|
@AttributeRootNode(value="nthl:file")
|
||||||
public class Content {
|
public class Content {
|
||||||
|
|
||||||
@Attribute(CONTENTSIZE)
|
@Attribute("hl:size")
|
||||||
Long size;
|
Long size;
|
||||||
|
|
||||||
@Attribute(CONTENTDATA)
|
@Attribute("jcr:data")
|
||||||
String data;
|
String data;
|
||||||
|
|
||||||
@Attribute(CONTENTREMOTEPATH)
|
@Attribute("hl:remotePath")
|
||||||
String remotePath;
|
String remotePath;
|
||||||
|
|
||||||
@Attribute(CONTENTMYMETYPE)
|
@Attribute("jcr:mimeType")
|
||||||
String mimeType;
|
String mimeType;
|
||||||
|
|
||||||
@Attribute(CONTENTID)
|
@Attribute("hl:storageId")
|
||||||
String storageId;
|
String storageId;
|
||||||
|
|
||||||
@NodeAttribute(value= PAYLOADBACKEND)
|
@JsonIgnore
|
||||||
PayloadBackend payloadBackend;
|
@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.Attribute;
|
||||||
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
|
import org.gcube.common.storagehub.model.annotations.AttributeRootNode;
|
||||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -12,12 +12,12 @@ import lombok.Setter;
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@AttributeRootNode(OWNERNODETYPE)
|
@AttributeRootNode(value="nthl:user")
|
||||||
public class Owner {
|
public class Owner {
|
||||||
|
|
||||||
@Attribute(PORTALLOGIN)
|
@Attribute("hl:portalLogin")
|
||||||
String userName;
|
String userName;
|
||||||
|
|
||||||
@Attribute(UNIQUEID)
|
@Attribute("hl:uuid")
|
||||||
String userId;
|
String userId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
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;
|
package org.gcube.common.storagehub.model.messages;
|
||||||
|
|
||||||
import static org.gcube.common.storagehub.model.NodeConstants.*;
|
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_NAME;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ import lombok.Setter;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@RootNode(MESSAGETYPE)
|
@RootNode("nthl:itemSentRequest")
|
||||||
public class Message extends RootItem{
|
public class Message extends RootItem{
|
||||||
|
|
||||||
boolean withAttachments;
|
boolean withAttachments;
|
||||||
|
|
|
@ -4,5 +4,5 @@ import java.util.Map;
|
||||||
|
|
||||||
public interface PluginParameters {
|
public interface PluginParameters {
|
||||||
|
|
||||||
Map<String, Object> getParameters();
|
Map<String, String> getParameters();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
package org.gcube.common.storagehub.model.storages;
|
package org.gcube.common.storagehub.model.storages;
|
||||||
|
|
||||||
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
|
|
||||||
|
|
||||||
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;
|
||||||
|
@ -16,6 +10,4 @@ public class MetaInfo {
|
||||||
String storageId;
|
String storageId;
|
||||||
|
|
||||||
String remotePath;
|
String remotePath;
|
||||||
|
|
||||||
PayloadBackend payloadBackend;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,81 +1,27 @@
|
||||||
package org.gcube.common.storagehub.model.storages;
|
package org.gcube.common.storagehub.model.storages;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.gcube.common.storagehub.model.exceptions.StorageIdNotFoundException;
|
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;
|
||||||
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
|
|
||||||
|
|
||||||
public abstract class StorageBackend {
|
public interface StorageBackend {
|
||||||
|
|
||||||
private PayloadBackend payloadConfiguration;
|
String getName();
|
||||||
|
|
||||||
public StorageBackend(PayloadBackend payloadConfiguration) {
|
String onCopy(AbstractFileItem item);
|
||||||
this.payloadConfiguration = payloadConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
String onMove(AbstractFileItem item);
|
||||||
|
|
||||||
public PayloadBackend getPayloadConfiguration() {
|
void onDelete(Content id);
|
||||||
return payloadConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setPayloadConfiguration(PayloadBackend payloadConfiguration) {
|
MetaInfo upload(InputStream stream, String relativePath, String name);
|
||||||
this.payloadConfiguration = payloadConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
InputStream download(Content item);
|
||||||
public abstract MetaInfo onCopy(Content content, String newParentPath, String newName);
|
|
||||||
|
|
||||||
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
|
@Deprecated
|
||||||
public abstract String getTotalSizeStored();
|
String getTotalSizeStored();
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public abstract String getTotalItemsCount();
|
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,17 +1,9 @@
|
||||||
package org.gcube.common.storagehub.model.storages;
|
package org.gcube.common.storagehub.model.storages;
|
||||||
|
|
||||||
import org.gcube.common.storagehub.model.exceptions.InvalidCallParameters;
|
public interface StorageBackendFactory<S extends StorageBackend> {
|
||||||
import org.gcube.common.storagehub.model.items.nodes.PayloadBackend;
|
|
||||||
|
|
||||||
public interface StorageBackendFactory {
|
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
default boolean isSystemStorage() {
|
S create(String parameter);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
StorageBackend create(PayloadBackend payloadConfiguration) throws InvalidCallParameters;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
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