Difference between revisions of "Home Library 2.0 API Framework Specification"

From Gcube Wiki
Jump to: navigation, search
(From Document to gCubeItem)
(Replaced content with "== The Home Library has been deprecated by the new [https://wiki.gcube-system.org/gcube/StorageHub_REST_API StorageHub Service] == Please use the StorageHub service for fu...")
 
(308 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Home Library  2.0 API =
+
== The Home Library has been deprecated by the new [https://wiki.gcube-system.org/gcube/StorageHub_REST_API StorageHub Service] ==
 
+
Please use the StorageHub service for future developments: https://wiki.gcube-system.org/gcube/StorageHub_REST_API
The Home Library is a library to manage and persist the users homes. that supports file sharing
+
Home Library user is presented with a personal workspace, where users can collaborate, share information, and access project resources using special folders. This module describes the model of Home Library 2.0 and how to use the new API interface.
+
 
+
== Design Model ==
+
 
+
The '''design model''' for Home Library identifies a core set of capabilities that  ...
+
 
+
The Home Library is defined through an API interface ('''HomeLibrary''' project).
+
 
+
Currently there is just one API implementation:
+
* '''HomeLibraryJCR''': an HomeLibrary implementation based on JCR 2.0 (Java Content Repository [http://jcp.org/en/jsr/detail?id=283 JSR 283]).
+
 
+
The Home Library dynamically load the implementation specified on properties file.
+
 
+
The core of Home Library 2.0 is a webService build on the top of the Jackrabbit web application. The goal of Home Library 2.0 is to expose content in the content repository as HTTP resources, fostering a RESTful style of application architecture.
+
[[File:WebApp.png]]
+
 
+
===Workspace Items===
+
 
+
Each element contained in a workspace area is a WorkspaceItem.The workspace items are the effective user objects.
+
 
+
The following figure shows the WorkspaceItem model.
+
[[File:areamodel.png]]
+
 
+
The following objects have been removed:
+
 
+
<source lang="java">
+
AquaMapsItem();
+
Annotation();
+
DocumentLink();
+
ImageDocumentLink();
+
PDFDocumentLink();
+
Annotation();
+
TabularDataLink();
+
ExternalResourceLink();
+
WorkflowReport();
+
WorkflowTemplate();
+
</source>
+
 
+
Objects mapped to gCubeItem:
+
 
+
<source lang="java">
+
Document();
+
ImageDocument();
+
Metadata();
+
PDFDocument();
+
UrlDocument();
+
</source>
+
 
+
===Compatibility===
+
 
+
 
+
====From Document to gCubeItem====
+
 
+
New Home Library API to retrieve Document Objects:
+
 
+
<source lang="java">
+
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.Document;
+
 
+
Document document = (Document) item;
+
 
+
becomes:
+
 
+
import org.gcube.common.homelibary.model.items.type.NodeProperty;
+
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
+
 
+
GCubeItem document = (GCubeItem) item;
+
 
+
</source>
+
 
+
How to retrieve properties:
+
 
+
<source lang="java">
+
document.getAlternatives(); -> document.getProperties().getProperties().get((NodeProperty.ALTERNATIVES.toString());
+
document.getAnnotation(); -> document.getProperties().getProperties().get((NodeProperty.ANNOTATIONS.toString());
+
document.getCollectionName(); -> document.getProperties().getProperties().get((NodeProperty.COLLECTION_NAME.toString());
+
document.getData(); -> document.getProperties().getProperties().get((NodeProperty.DATA.toString());
+
document.getFolderItemType(); -> document.getProperties().getProperties().get((NodeProperty.FOLDER_ITEM_TYPE.toString());
+
document.getLength(); -> document.getProperties().getProperties().get((NodeProperty.SIZE.toString());
+
document.getMetadata(); -> document.getProperties().getProperties().get((NodeProperty.METADATA.toString());
+
document.getMimeType(); -> document.getProperties().getProperties().get((NodeProperty.MIME_TYPE.toString()); 
+
document.getParts(); -> document.getProperties().getProperties().get((NodeProperty.PARTS.toString());
+
document.getURI(); -> document.getProperties().getProperties().get((NodeProperty.OID.toString()); 
+
document.getWorkflowData(); -> document.getProperties().getProperties().get((NodeProperty.WORKFLOW_DATA.toString()); 
+
document.getWorkflowId(); -> document.getProperties().getProperties().get((NodeProperty.WORKFLOW_ID.toString()); 
+
document.getWorkflowStatus(); -> document.getProperties().getProperties().get((NodeProperty.WORKFLOW_STATUS.toString()); 
+
 
+
</source>
+
 
+
====From ImageDocument to gCubeItem====
+
 
+
<source lang="java">
+
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.ImageDocument;
+
 
+
ImageDocument document = (ImageDocument) item;
+
 
+
becomes:
+
 
+
import org.gcube.common.homelibary.model.items.type.NodeProperty;
+
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
+
 
+
GCubeItem document = (GCubeItem) item;
+
 
+
</source>
+
 
+
To retrieve properties, use the APIs for Document Object and the following APIs:
+
 
+
<source lang="java">
+
document.getHeight(); -> document.getProperties().getProperties().get((NodeProperty.IMAGE_HEIGHT.toString()); 
+
document.getWidth(); -> document.getProperties().getProperties().get((NodeProperty.IMAGE_WIDTH.toString()); 
+
document.getThumbnailHeight(); -> document.getProperties().getProperties().get((NodeProperty.THUMBNAIL_HEIGHT.toString());   
+
document.getThumbnailWidth(); -> document.getProperties().getProperties().get((NodeProperty.THUMBNAIL_WIDTH.toString()); 
+
document.getThumbnail(); -> document.getProperties().getProperties().get((NodeProperty.THUMBNAIL_DATA.toString());
+
document.getThumbnailLength(); -> document.getThumbnail().getSize();
+
+
</source>
+
 
+
====From Metadata to gCubeItem====
+
 
+
<source lang="java">
+
import org.gcube.common.homelibrary.home.workspace.folder.items.gcube.Metadata;
+
 
+
Metadata document = (Metadata) item;
+
 
+
becomes:  
+
 
+
import org.gcube.common.homelibary.model.items.type.NodeProperty;
+
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
+
 
+
GCubeItem document = (GCubeItem) item;
+
 
+
</source>
+
 
+
To retrieve properties:
+
 
+
<source lang="java">
+
document.getURI(); -> document.getProperties().getProperties().get((NodeProperty.OID.toString()); 
+
document.getWorkflowData(); -> document.getProperties().getProperties().get((NodeProperty.WORKFLOW_DATA.toString()); 
+
document.getWorkflowId(); -> document.getProperties().getProperties().get((NodeProperty.WORKFLOW_ID.toString()); 
+
document.getWorkflowStatus(); -> document.getProperties().getProperties().get((NodeProperty.WORKFLOW_STATUS.toString());
+
 
+
document.getSchemaName(); -> document.getProperties().getProperties().get((NodeProperty.SCHEMA.toString());
+
document.getXML(); -> document.getProperties().getProperties().get((NodeProperty.ALTERNATIVES.toString());
+
document.getCollectionName(); -> document.getProperties().getProperties().get((NodeProperty.COLLECTION_NAME.toString());
+
document.getURI(); -> document.getProperties().getProperties().get((NodeProperty.OID.toString()); 
+
 
+
</source>
+
 
+
====From PDFDocument to gCubeItem====
+
 
+
<source lang="java">
+
 
+
import org.gcube.common.homelibary.model.items.type.NodeProperty;
+
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
+
 
+
ImageDocument image = (ImageDocument) item;
+
becomes
+
gCubeItem image = (gCubeItem) item;
+
 
+
image.getWidth() -> image.getItemProperties().getPropertyValue(NodeProperty.IMAGE_WIDTH.toString());
+
image.getHeight() -> image.getItemProperties().getPropertyValue(NodeProperty.IMAGE_HEIGHT.toString());
+
image.getThumbnailWidth() -> image.getItemProperties().getPropertyValue(NodeProperty.THUMBNAIL_WIDTH.toString());
+
image.getThumbnailHeight() -> image.getItemProperties().getPropertyValue(NodeProperty.THUMBNAIL_HEIGHT.toString());
+
image.getThumbnailLength() -> image.getItemProperties().getPropertyValue(NodeProperty.IMAGE_WIDTH.toString());  ?
+
image.getURI() -> image.getItemProperties().getPropertyValue(NodeProperty.OID.toString());
+
image.getCollectionName() -> image.getItemProperties().getPropertyValue(NodeProperty.COLLECTION_NAME.toString());
+
image.getAlternatives() -> image.getItemProperties().getPropertyValue(NodeProperty.ALTERNATIVES.toString());
+
image.getParts() -> image.getItemProperties().getPropertyValue(NodeProperty.PARTS.toString());
+
image.getMetadata() -> image.getItemProperties().getPropertyValue(NodeProperty.METADATA.toString());
+
 
+
</source>
+
 
+
====From UrlDocument to gCubeItem====
+
 
+
<source lang="java">
+
 
+
import org.gcube.common.homelibary.model.items.type.NodeProperty;
+
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
+
 
+
ImageDocument image = (ImageDocument) item;
+
becomes
+
gCubeItem image = (gCubeItem) item;
+
 
+
image.getWidth() -> image.getItemProperties().getPropertyValue(NodeProperty.IMAGE_WIDTH.toString());
+
image.getHeight() -> image.getItemProperties().getPropertyValue(NodeProperty.IMAGE_HEIGHT.toString());
+
image.getThumbnailWidth() -> image.getItemProperties().getPropertyValue(NodeProperty.THUMBNAIL_WIDTH.toString());
+
image.getThumbnailHeight() -> image.getItemProperties().getPropertyValue(NodeProperty.THUMBNAIL_HEIGHT.toString());
+
image.getThumbnailLength() -> image.getItemProperties().getPropertyValue(NodeProperty.IMAGE_WIDTH.toString());  ?
+
image.getURI() -> image.getItemProperties().getPropertyValue(NodeProperty.OID.toString());
+
image.getCollectionName() -> image.getItemProperties().getPropertyValue(NodeProperty.COLLECTION_NAME.toString());
+
image.getAlternatives() -> image.getItemProperties().getPropertyValue(NodeProperty.ALTERNATIVES.toString());
+
image.getParts() -> image.getItemProperties().getPropertyValue(NodeProperty.PARTS.toString());
+
image.getMetadata() -> image.getItemProperties().getPropertyValue(NodeProperty.METADATA.toString());
+
 
+
</source>
+
 
+
== Implementation Framework ==
+
 
+
The '''Home Library  2.0 API''' is a set of components that support the development of .... that comply with the model. Through code sharing, the framework reduces development costs and ensures the consistency and correctness of library implementations.
+
 
+
== Management Model ==
+
If Needed
+
 
+
 
+
== How to ==
+
To use Home Library 2.0, import the following dependencies:
+
<source lang="xml">
+
<dependency>
+
<groupId>org.gcube.common</groupId>
+
<artifactId>home-library-jcr</artifactId>
+
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
+
</dependency>
+
+
<dependency>
+
<groupId>org.gcube.common</groupId>
+
<artifactId>home-library</artifactId>
+
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
+
</dependency>
+
</source>
+

Latest revision as of 11:52, 18 January 2019

The Home Library has been deprecated by the new StorageHub Service

Please use the StorageHub service for future developments: https://wiki.gcube-system.org/gcube/StorageHub_REST_API