Creating Trunk Branch

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-publisher@130465 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2016-07-18 09:58:09 +00:00
commit c5d0bac028
9 changed files with 736 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.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="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<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-publisher</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

113
pom.xml Normal file
View File

@ -0,0 +1,113 @@
<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-publisher</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Resource Registry Publisher</name>
<description>Contains Non Idempotent API for Resource Registry</description>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>gcube-bom</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-generic-clients</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-gcube-calls</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-fw-clients</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.information-system</groupId>
<artifactId>resource-registry-api</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</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>
</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,33 @@
package org.gcube.informationsystem.resourceregistry.publisher.plugin;
import org.gcube.common.clients.Plugin;
import org.gcube.informationsystem.resourceregistry.Constants;
/**
*
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
* @param <S>
* @param <P>
*/
public abstract class AbstractPlugin<S, P> implements Plugin<S, P> {
public final String name;
public AbstractPlugin(String name) {
this.name = name;
}
public String serviceClass() {
return Constants.SERVICE_CLASS;
}
public String serviceName() {
return Constants.SERVICE_NAME;
}
public String name() {
return name;
}
}

View File

@ -0,0 +1,55 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.publisher.plugin;
import org.gcube.common.clients.GCubeEndpoint;
import org.gcube.common.clients.config.ProxyConfig;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.publisher.proxy.ResourceRegistryPublisher;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ResourceRegistryRegistryPlugin extends AbstractPlugin<GCubeEndpoint, ResourceRegistryPublisher>{
public ResourceRegistryRegistryPlugin(){
super(ResourceRegistryRegistryPlugin.class.getSimpleName());
}
@Override
public String namespace() {
// TODO Auto-generated method stub
return null;
}
@Override
public Exception convert(Exception fault, ProxyConfig<?, ?> config) {
// The Jersey client wraps the exception. So we need to get the wrapped
// exception thrown by ResourceRegistry Service.
Throwable throwable = fault.getCause();
if(throwable != null && throwable instanceof ResourceRegistryException){
return (Exception) throwable;
}
return fault;
}
@Override
public GCubeEndpoint resolve(GCubeEndpoint address, ProxyConfig<?, ?> config)
throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public ResourceRegistryPublisher newProxy(
ProxyDelegate<GCubeEndpoint> delegate) {
return new ResourceRegistryPublisher(delegate);
}
}

View File

@ -0,0 +1,461 @@
/**
*
*/
package org.gcube.informationsystem.resourceregistry.publisher.proxy;
import org.gcube.common.clients.Call;
import org.gcube.common.clients.GCubeEndpoint;
import org.gcube.common.clients.delegates.AsyncProxyDelegate;
import org.gcube.common.clients.delegates.ProxyDelegate;
import org.gcube.common.clients.exceptions.ServiceException;
import org.gcube.informationsystem.resourceregistry.api.ContextManagement;
import org.gcube.informationsystem.resourceregistry.api.EntityManagement;
import org.gcube.informationsystem.resourceregistry.api.SchemaManagement;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
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;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*/
public class ResourceRegistryPublisher implements ContextManagement, SchemaManagement, EntityManagement {
private final AsyncProxyDelegate<GCubeEndpoint> delegate;
public ResourceRegistryPublisher(ProxyDelegate<GCubeEndpoint> config) {
this.delegate = new AsyncProxyDelegate<GCubeEndpoint>(config);
}
@Override
public String createFacet(String facetType, String jsonRepresentation)
throws ResourceRegistryException {
Call<GCubeEndpoint, String> call = new Call<GCubeEndpoint, String>() {
public String call(GCubeEndpoint endpoint) throws Exception {
// TODO
return null;
};
};
try {
return delegate.make(call);
} catch (Exception e) {
throw new ServiceException(e);
}
}
@Override
public String readFacet(String uuid) throws FacetNotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public String updateFacet(String uuid, String jsonRepresentation)
throws FacetNotFoundException, ResourceRegistryException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean deleteFacet(String uuid) throws FacetNotFoundException,
ResourceRegistryException {
// TODO Auto-generated method stub
return false;
}
@Override
public String createResource(String resourceType, String jsonRepresentation)
throws ResourceRegistryException {
// TODO Auto-generated method stub
return null;
}
@Override
public String readResource(String uuid) throws ResourceNotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean deleteResource(String uuid)
throws ResourceNotFoundException, ResourceRegistryException {
// TODO Auto-generated method stub
return false;
}
@Override
public String registerFacetSchema(String jsonSchema) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getFacetSchema(String facetType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public String registerResourceSchema(String jsonSchema) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getResourceSchema(String resourceType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
@Override
public String create(final String parentContextUUID,final String jsonRepresentation)
throws ContextCreationException {
// TODO Auto-generated method stub
return null;
}
@Override
public String rename(String contextUUID, String newName)
throws ContextNotFoundException, ContextException {
// TODO Auto-generated method stub
return null;
}
@Override
public String move(String newParentUUID, String contextToMoveUUID)
throws ContextNotFoundException, ContextException {
// TODO Auto-generated method stub
return null;
}
@Override
public String delete(String uuid) throws ContextNotFoundException,
ContextException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.EntityManagement#readFacet(java.lang.String, java.lang.String)
*/
@Override
public String readFacet(String uuid, String facetType)
throws FacetNotFoundException, ResourceRegistryException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.EntityManagement#readResource(java.lang.String, java.lang.String)
*/
@Override
public String readResource(String uuid, String resourceType)
throws ResourceNotFoundException, ResourceRegistryException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.EntityManagement#attachFacet(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public String attachFacet(String resourceUUID, String facetUUID,
String consistOfType, String jsonProperties)
throws FacetNotFoundException, ResourceNotFoundException,
ResourceRegistryException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.EntityManagement#detachFacet(java.lang.String)
*/
@Override
public boolean detachFacet(String consistOfUUID)
throws ResourceRegistryException {
// TODO Auto-generated method stub
return false;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.EntityManagement#attachResource(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public String attachResource(String sourceResourceUUID,
String targetResourceUUID, String relatedToType,
String jsonProperties) throws ResourceNotFoundException,
ResourceRegistryException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.EntityManagement#detachResource(java.lang.String)
*/
@Override
public boolean detachResource(String relatedToUUID)
throws ResourceRegistryException {
// TODO Auto-generated method stub
return false;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#registerEntitySchema(java.lang.String)
*/
@Override
public String registerEntitySchema(String jsonSchema)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#getEntitySchema(java.lang.String)
*/
@Override
public String getEntitySchema(String entityType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateEntitySchema(java.lang.String, java.lang.String)
*/
@Override
public String updateEntitySchema(String entityType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteEntitySchema(java.lang.String)
*/
@Override
public String deleteEntitySchema(String entityType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateFacetSchema(java.lang.String, java.lang.String)
*/
@Override
public String updateFacetSchema(String facetType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteFacetSchema(java.lang.String)
*/
@Override
public String deleteFacetSchema(String facetType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateResourceSchema(java.lang.String, java.lang.String)
*/
@Override
public String updateResourceSchema(String resourceType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteResourceSchema(java.lang.String)
*/
@Override
public String deleteResourceSchema(String resourceType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#registerEmbeddedTypeSchema(java.lang.String)
*/
@Override
public String registerEmbeddedTypeSchema(String jsonSchema)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#getEmbeddedTypeSchema(java.lang.String)
*/
@Override
public String getEmbeddedTypeSchema(String embeddedType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateEmbeddedTypeSchema(java.lang.String, java.lang.String)
*/
@Override
public String updateEmbeddedTypeSchema(String embeddedType,
String jsonSchema) throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteEmbeddedTypeSchema(java.lang.String)
*/
@Override
public String deleteEmbeddedTypeSchema(String embeddedType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#registerRelationSchema(java.lang.String)
*/
@Override
public String registerRelationSchema(String jsonSchema)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#getRelationSchema(java.lang.String)
*/
@Override
public String getRelationSchema(String relationType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateRelationSchema(java.lang.String, java.lang.String)
*/
@Override
public String updateRelationSchema(String relationType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteRelationSchema(java.lang.String)
*/
@Override
public String deleteRelationSchema(String relationType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#registerConsistOfSchema(java.lang.String)
*/
@Override
public String registerConsistOfSchema(String jsonSchema)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#getConsistOfSchema(java.lang.String)
*/
@Override
public String getConsistOfSchema(String consistOfType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateConsistOfSchema(java.lang.String, java.lang.String)
*/
@Override
public String updateConsistOfSchema(String consistOfType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteConsistOfSchema(java.lang.String)
*/
@Override
public String deleteConsistOfSchema(String consistOfType)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#registerRelatedToSchema(java.lang.String)
*/
@Override
public String registerRelatedToSchema(String jsonSchema)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#getRelatedToSchema(java.lang.String)
*/
@Override
public String getRelatedToSchema(String relatedToType)
throws SchemaNotFoundException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#updateRelatedToSchema(java.lang.String, java.lang.String)
*/
@Override
public String updateRelatedToSchema(String relatedToType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.SchemaManagement#deleteRelatedToSchema(java.lang.String)
*/
@Override
public String deleteRelatedToSchema(String relatedToType)
throws SchemaException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.gcube.informationsystem.resourceregistry.api.ContextManagement#read(java.lang.String)
*/
@Override
public String read(String contextUUID) throws ContextNotFoundException,
ContextException {
// TODO Auto-generated method stub
return null;
}
}