Creating Trunk Branch

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-api@130461 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-07-18 09:56:56 +00:00
commit 13af090482
30 changed files with 843 additions and 0 deletions

36
.classpath Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>resource-registry-api</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

4
distro/LICENSE Normal file
View File

@ -0,0 +1,4 @@
gCube System - License
------------------------------------------------------------
${gcube.license}

65
distro/README Normal file
View File

@ -0,0 +1,65 @@
The gCube System - ${name}
--------------------------------------------------
${description}
${gcube.description}
${gcube.funding}
Version
--------------------------------------------------
${version} (${buildDate})
Please see the file named "changelog.xml" in this directory for the release notes.
Authors
--------------------------------------------------
* Luca Frosini (luca.frosini-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
Maintainers
-----------
* Luca Frosini (luca.frosini-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
Download information
--------------------------------------------------
Source code is available from SVN:
${scm.url}
Binaries can be downloaded from the gCube website:
${gcube.website}
Installation
--------------------------------------------------
Installation documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}/InformationSystem
Documentation
--------------------------------------------------
Documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}/InformationSystem
Support
--------------------------------------------------
Bugs and support requests can be reported in the gCube issue tracking tool:
${gcube.issueTracking}
Licensing
--------------------------------------------------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

5
distro/changelog.xml Normal file
View File

@ -0,0 +1,5 @@
<ReleaseNotes>
<Changeset component="org.gcube.information-system.information-collector.api.1-0-0" date="${buildDate}">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

31
distro/descriptor.xml Normal file
View File

@ -0,0 +1,31 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>changelog.xml</include>
<include>profile.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.jar</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

26
distro/profile.xml Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
<ID />
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>${serviceClass}</Class>
<Name>${artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>${build.finalName}.jar</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

118
pom.xml Normal file
View File

@ -0,0 +1,118 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Information Collector Api</name>
<description>Information Collector Api</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<distroDirectory>${project.basedir}/distro</distroDirectory>
<serviceClass>InformationSystem</serviceClass>
</properties>
<scm>
<connection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube//trunk/information-system/${project.artifactId}</developerConnection>
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/${project.artifactId}</url>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-smartgears-bom</artifactId>
<version>2.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>information-system-model</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test Dependency -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,27 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class AccessRESTPath {
public static final String ACCESS_PATH_PART = "access";
public static final String QUERY_PARAM = "query";
public static final String FETCH_PLAN_PARAM = "fetchPlan";
public static final String FACET_PATH_PART = "facet";
public static final String FACET_ID_PATH_PARAM = "facetId";
public static final String FACET_TYPE_PATH_PARAM = "facetType";
public static final String RESOURCE_PATH_PART = "resource";
public static final String RESOURCE_ID_PATH_PARAM = "resourceId";
public static final String RESOURCE_TYPE_PATH_PARAM = "resourceType";
public static final String SCHEMA_PATH_PART = "schema";
}

View File

@ -0,0 +1,11 @@
package org.gcube.informationsystem.resourceregistry;
public class Constants {
public static final String SERVICE_CLASS = "InformationSystem";
public static final String SERVICE_NAME = "ResourceRegistry";
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.api;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public interface ContextManagement {
public String create(String parentContextUUID, String name) throws ContextCreationException;
public String read(String contextUUID) throws ContextNotFoundException, ContextException;
public String rename(String contextUUID, String newName) throws ContextNotFoundException, ContextException;
public String move(String newParentUUID, String contextToMoveUUID) throws ContextNotFoundException, ContextException;
public String delete(String uuid) throws ContextNotFoundException, ContextException;
}

View File

@ -0,0 +1,67 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.api;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.EntityException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.ResourceNotFoundException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public interface EntityManagement {
/* Facets Methods */
public String createFacet(String facetType, String jsonRepresentation)
throws EntityException, ResourceRegistryException;
public String readFacet(String uuid) throws FacetNotFoundException,
ResourceRegistryException;
public String readFacet(String uuid, String facetType)
throws FacetNotFoundException, ResourceRegistryException;
public String updateFacet(String uuid, String jsonRepresentation)
throws FacetNotFoundException, ResourceRegistryException;
public boolean deleteFacet(String uuid) throws FacetNotFoundException,
ResourceRegistryException;
/* Resources Methods */
public String createResource(String resourceType, String jsonRepresentation)
throws ResourceRegistryException;
public String readResource(String uuid) throws ResourceNotFoundException,
ResourceRegistryException;
public String readResource(String uuid, String resourceType)
throws ResourceNotFoundException, ResourceRegistryException;
public boolean deleteResource(String uuid)
throws ResourceNotFoundException, ResourceRegistryException,
ResourceRegistryException;
/* Relations Methods */
public String attachFacet(String resourceUUID, String facetUUID,
String consistOfType, String jsonProperties)
throws FacetNotFoundException, ResourceNotFoundException,
ResourceRegistryException;
public boolean detachFacet(String consistOfUUID)
throws ResourceRegistryException;
public String attachResource(String sourceResourceUUID,
String targetResourceUUID, String relatedToType,
String jsonProperties) throws ResourceNotFoundException,
ResourceRegistryException;
public boolean detachResource(String relatedToUUID)
throws ResourceRegistryException;
}

View File

@ -0,0 +1,24 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.api;
import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public interface Query {
/**
* @param query
* @param fetchPlan
* @return
* @throws InvalidQueryException
* http://orientdb.com/docs/last/OrientDB-REST.html#query
*/
String execute(String query, String fetchPlan)
throws InvalidQueryException;
}

View File

@ -0,0 +1,80 @@
package org.gcube.informationsystem.resourceregistry.api;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
/**
* Service Endpoint Interface
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
* For JSON schema see
* http://orientdb.com/docs/last/OrientDB-REST.html#class
*
*/
public interface SchemaManagement {
public String registerEntitySchema(String jsonSchema) throws SchemaException;
public String getEntitySchema(String entityType) throws SchemaNotFoundException;
public String updateEntitySchema(String entityType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteEntitySchema(String entityType) throws SchemaNotFoundException;
public String registerFacetSchema(String jsonSchema) throws SchemaException;
public String getFacetSchema(String facetType) throws SchemaNotFoundException;
public String updateFacetSchema(String facetType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteFacetSchema(String facetType) throws SchemaNotFoundException;
public String registerResourceSchema(String jsonSchema) throws SchemaException;
public String getResourceSchema(String resourceType) throws SchemaNotFoundException;
public String updateResourceSchema(String resourceType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteResourceSchema(String resourceType) throws SchemaNotFoundException;
public String registerEmbeddedTypeSchema(String jsonSchema) throws SchemaException;
public String getEmbeddedTypeSchema(String embeddedType) throws SchemaNotFoundException;
public String updateEmbeddedTypeSchema(String embeddedType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteEmbeddedTypeSchema(String embeddedType) throws SchemaNotFoundException;
public String registerRelationSchema(String jsonSchema) throws SchemaException;
public String getRelationSchema(String relationType) throws SchemaNotFoundException;
public String updateRelationSchema(String relationType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteRelationSchema(String relationType) throws SchemaNotFoundException;
public String registerConsistOfSchema(String jsonSchema) throws SchemaException;
public String getConsistOfSchema(String consistOfType) throws SchemaNotFoundException;
public String updateConsistOfSchema(String consistOfType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteConsistOfSchema(String consistOfType) throws SchemaException;
public String registerRelatedToSchema(String jsonSchema) throws SchemaException;
public String getRelatedToSchema(String relatedToType) throws SchemaNotFoundException;
public String updateRelatedToSchema(String relatedToType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteRelatedToSchema(String relatedToType) throws SchemaException;
}

View File

@ -0,0 +1,24 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class InvalidQueryException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -5146082051190251441L;
public InvalidQueryException(String message, Throwable cause) {
super(message, cause);
}
public InvalidQueryException(String message) {
super(message);
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public interface NotAllowedException {
}

View File

@ -0,0 +1,9 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public interface ObjectNotFound {
}

View File

@ -0,0 +1,29 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.api.exceptions;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ResourceRegistryException extends Exception {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -8321258637131836003L;
public ResourceRegistryException(String message) {
super(message);
}
public ResourceRegistryException(Throwable cause) {
super(cause);
}
public ResourceRegistryException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -0,0 +1,19 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.api.exceptions.context;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*/
public class ContextCreationException extends ContextException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -7235498402448768270L;
public ContextCreationException(String message) {
super(message);
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ContextException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8119058749936021156L;
public ContextException(String message) {
super(message);
}
public ContextException(Throwable cause) {
super(cause);
}
public ContextException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -0,0 +1,19 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.context;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ContextMoveException extends ContextException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8119058749936021156L;
public ContextMoveException(String message) {
super(message);
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.context;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ObjectNotFound;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ContextNotFoundException extends ContextException implements ObjectNotFound {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8119058749936021156L;
public ContextNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class EntityException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8119058749936021156L;
public EntityException(String message) {
super(message);
}
public EntityException(Throwable cause) {
super(cause);
}
public EntityException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ObjectNotFound;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class FacetNotFoundException extends EntityException implements ObjectNotFound {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -1687373446724146351L;
public FacetNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.entity;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ObjectNotFound;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ResourceNotFoundException extends ContextException implements ObjectNotFound {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -1687373446724146351L;
public ResourceNotFoundException(String message) {
super(message);
}
}

View File

@ -0,0 +1,29 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.schema;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class SchemaException extends ResourceRegistryException {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8119058749936021156L;
public SchemaException(String message) {
super(message);
}
public SchemaException(Throwable cause) {
super(cause);
}
public SchemaException(String message, Throwable cause) {
super(message, cause);
}
}

View File

@ -0,0 +1,27 @@
package org.gcube.informationsystem.resourceregistry.api.exceptions.schema;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ObjectNotFound;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class SchemaNotFoundException extends SchemaException implements ObjectNotFound {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = -7068170595199626085L;
public SchemaNotFoundException(String message) {
super(message);
}
public SchemaNotFoundException(Throwable cause) {
super(cause);
}
public SchemaNotFoundException(String message, Throwable cause) {
super(message, cause);
}
}