commit 1eee18c4591e85a3ec485c89d85a700dfc047973 Author: Luca Frosini Date: Tue Jan 29 16:43:59 2019 +0000 Creating a gcat-client refs #13216 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-publishing/gcat-api@176864 82a268e6-3cf1-43bd-a215-b396298e98cf diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fae1a2b --- /dev/null +++ b/.classpath @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..f8532ce --- /dev/null +++ b/.project @@ -0,0 +1,23 @@ + + + gcat-api + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..29abf99 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -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/=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..714351a --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/.settings/org.eclipse.m2e.core.prefs b/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..e776286 --- /dev/null +++ b/pom.xml @@ -0,0 +1,83 @@ + + 4.0.0 + + org.gcube.tools + maven-parent + 1.0.0 + + + org.gcube.data-publishing + gcat-api + 1.0.0-SNAPSHOT + gCat APIs + gCat APIs + + + + + org.gcube.distribution + gcube-bom + LATEST + pom + import + + + org.gcube.distribution + gcube-smartgears-bom + LATEST + pom + import + + + + + + UTF-8 + ${project.basedir}/distro + DataPublishing + + + + scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-publishing/${project.artifactId} + scm:https://svn.d4science.research-infrastructures.eu/gcube//trunk/data-publishing/${project.artifactId} + https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-publishing/${project.artifactId} + + + + + org.slf4j + slf4j-api + provided + + + + junit + junit + 4.11 + test + + + ch.qos.logback + logback-classic + 1.0.13 + test + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + make-servicearchive + package + + + + + + \ No newline at end of file diff --git a/src/main/java/org/gcube/gcat/api/GCatConstants.java b/src/main/java/org/gcube/gcat/api/GCatConstants.java new file mode 100644 index 0000000..1f1b9c1 --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/GCatConstants.java @@ -0,0 +1,14 @@ +package org.gcube.gcat.api; + +public class GCatConstants { + + public static final String SERVICE_CLASS = "DataPublishing"; + public static final String SERVICE_NAME = "gcat"; + + public static final String SERVICE_ENTRY_NAME = "org.gcube.gcat.ResourceInitializer"; + public static final String PURGE_QUERY_PARAMETER = "purge"; + public static final String APPLICATION_JSON_CHARSET_UTF_8 = "application/json;charset=UTF-8"; + public static final String LIMIT_PARAMETER = "limit"; + public static final String OFFSET_PARAMETER = "offset"; + +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/CRUD.java b/src/main/java/org/gcube/gcat/api/interfaces/CRUD.java new file mode 100644 index 0000000..b89cefd --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/CRUD.java @@ -0,0 +1,14 @@ +package org.gcube.gcat.api.interfaces; + +import javax.xml.ws.WebServiceException; + +public interface CRUD { + + public C create(String json) throws WebServiceException; + + public String read(String name) throws WebServiceException ; + + public String update(String name, String json) throws WebServiceException; + + public D delete(String name) throws WebServiceException; +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/Group.java b/src/main/java/org/gcube/gcat/api/interfaces/Group.java new file mode 100644 index 0000000..679464c --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/Group.java @@ -0,0 +1,20 @@ +package org.gcube.gcat.api.interfaces; + +import javax.xml.ws.WebServiceException; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface Group extends CRUD { + + String GROUPS = "groups"; + + public String list(int limit, int offset) throws WebServiceException; + + public String patch(String name, String json) throws WebServiceException; + + public D delete(String name, boolean purge) throws WebServiceException; + + public D purge(String name) throws WebServiceException; + +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/Item.java b/src/main/java/org/gcube/gcat/api/interfaces/Item.java new file mode 100644 index 0000000..28dc2e5 --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/Item.java @@ -0,0 +1,17 @@ +package org.gcube.gcat.api.interfaces; + +import javax.xml.ws.WebServiceException; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface Item extends CRUD { + + String ITEMS = "items"; + + public String list(int limit, int offset) throws WebServiceException; + + public D delete(String name, boolean purge) throws WebServiceException; + + public D purge(String name) throws WebServiceException; +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/License.java b/src/main/java/org/gcube/gcat/api/interfaces/License.java new file mode 100644 index 0000000..cb8631d --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/License.java @@ -0,0 +1,12 @@ +package org.gcube.gcat.api.interfaces; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface License { + + String LICENSES = "licenses"; + + public String list(); + +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/Namespace.java b/src/main/java/org/gcube/gcat/api/interfaces/Namespace.java new file mode 100644 index 0000000..98fd5a6 --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/Namespace.java @@ -0,0 +1,12 @@ +package org.gcube.gcat.api.interfaces; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface Namespace { + + String NAMESPACES = "namespaces"; + + public String list(); + +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/Organization.java b/src/main/java/org/gcube/gcat/api/interfaces/Organization.java new file mode 100644 index 0000000..d776838 --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/Organization.java @@ -0,0 +1,14 @@ +package org.gcube.gcat.api.interfaces; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface Organization extends CRUD { + + String ORGANIZATIONS = "organizations"; + + public String list(int limit, int offset); + + public String patch(String name, String json); + +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/Profile.java b/src/main/java/org/gcube/gcat/api/interfaces/Profile.java new file mode 100644 index 0000000..b4e9297 --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/Profile.java @@ -0,0 +1,20 @@ +package org.gcube.gcat.api.interfaces; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface Profile { + + String PROFILES = "profiles"; + + public String list(); + + public C create(String name, String xml); + + public String read(String name); + + public String update(String name, String xml); + + public D delete(String name); + +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/Resource.java b/src/main/java/org/gcube/gcat/api/interfaces/Resource.java new file mode 100644 index 0000000..d32dccf --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/Resource.java @@ -0,0 +1,19 @@ +package org.gcube.gcat.api.interfaces; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface Resource { + + String RESOURCES = "resources"; + + public String list(String itemID); + + public C create(String itemID, String json); + + public String read(String itemID,String resourceID); + + public String update(String itemID, String resourceID, String json); + + public D delete(String itemID, String resourceID); +} diff --git a/src/main/java/org/gcube/gcat/api/interfaces/User.java b/src/main/java/org/gcube/gcat/api/interfaces/User.java new file mode 100644 index 0000000..cde96f2 --- /dev/null +++ b/src/main/java/org/gcube/gcat/api/interfaces/User.java @@ -0,0 +1,21 @@ +package org.gcube.gcat.api.interfaces; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface User extends CRUD { + + String USERS = "users"; + + public String list(); + + @Override + public String read(String username); + + @Override + public String update(String username, String json); + + @Override + public D delete(String username); + +}