model for Messages and ExternalFolder added
parent
4c129ed264
commit
c249caafe6
@ -0,0 +1,32 @@
|
||||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class PluginInitializationException extends StorageHubException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PluginInitializationException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PluginInitializationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "invalid parameters for plugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.gcube.common.storagehub.model.exceptions;
|
||||
|
||||
import org.gcube.common.clients.delegates.Unrecoverable;
|
||||
|
||||
@Unrecoverable
|
||||
public class PluginNotFoundException extends StorageHubException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public PluginNotFoundException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PluginNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getErrorMessage() {
|
||||
return "plugin not found";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatus() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +1,23 @@
|
||||
package org.gcube.common.storagehub.model.items;
|
||||
|
||||
import 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.ExternalRepository;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
@RootNode("nthl:workspaceItem")
|
||||
public class FolderItem extends Item {
|
||||
|
||||
|
||||
@NodeAttribute(value =NodeConstants.EXTERNALREPOSITORY_NAME)
|
||||
ExternalRepository externalRepository;
|
||||
|
||||
public boolean isExternalRoot() {
|
||||
return externalRepository != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package org.gcube.common.storagehub.model.items;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public abstract class RootItem {
|
||||
|
||||
//for service internal use
|
||||
@JsonIgnore
|
||||
transient Object relatedNode;
|
||||
|
||||
String id;
|
||||
|
||||
String name;
|
||||
|
||||
String path;
|
||||
|
||||
String parentId;
|
||||
|
||||
String parentPath;
|
||||
|
||||
String primaryType;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.gcube.common.storagehub.model.items.nodes;
|
||||
|
||||
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.AttributeRootNode;
|
||||
import org.gcube.common.storagehub.model.annotations.NodeAttribute;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@AttributeRootNode(value="nthl:externalRepostiory")
|
||||
public class ExternalRepository {
|
||||
|
||||
@Attribute("hl:pluginName")
|
||||
String plugin;
|
||||
|
||||
@JsonIgnore
|
||||
@NodeAttribute(value=PARAMETERS_NAME)
|
||||
Metadata metadata = new Metadata();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package org.gcube.common.storagehub.model.messages;
|
||||
|
||||
import static org.gcube.common.storagehub.model.NodeConstants.OWNER_NAME;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
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.items.RootItem;
|
||||
import org.gcube.common.storagehub.model.items.nodes.Owner;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@RootNode("nthl:itemSentRequest")
|
||||
public class Message extends RootItem{
|
||||
|
||||
boolean withAttachments;
|
||||
|
||||
@NodeAttribute(value=OWNER_NAME)
|
||||
Owner sender;
|
||||
|
||||
@Attribute("hl:subject")
|
||||
String subject;
|
||||
|
||||
@Attribute("hl:body")
|
||||
String body;
|
||||
|
||||
@Attribute("hl:read")
|
||||
boolean read;
|
||||
|
||||
@Attribute("hl:open")
|
||||
boolean opened;
|
||||
|
||||
@Attribute("hl:addresses")
|
||||
String[] addresses;
|
||||
|
||||
@Attribute(value = "jcr:created", isReadOnly=true)
|
||||
Calendar creationTime;
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package org.gcube.common.storagehub.model.plugins;
|
||||
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
|
||||
public interface ExternalFolderManager {
|
||||
|
||||
void onFolderCreated(String relPath, FolderItem folder);
|
||||
|
||||
void onDeleteFolder(String relPath);
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package org.gcube.common.storagehub.model.plugins;
|
||||
|
||||
import org.gcube.common.storagehub.model.exceptions.PluginInitializationException;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
|
||||
public interface ExternalFolderManagerConnector {
|
||||
|
||||
public default String getName() {
|
||||
return this.getClass().getCanonicalName();
|
||||
}
|
||||
|
||||
ExternalFolderManager connect(FolderItem item, PluginParameters parameters) throws PluginInitializationException;
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package org.gcube.common.storagehub.model.plugins;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface PluginParameters {
|
||||
|
||||
Map<String, String> getParameters();
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.gcube.common.storagehub.model.types;
|
||||
|
||||
import java.util.List;
|
||||
import org.gcube.common.storagehub.model.messages.Message;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class MessageList {
|
||||
|
||||
List<Message> messages;
|
||||
|
||||
}
|
Loading…
Reference in New Issue