diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ResourceInitializer.java b/src/main/java/org/gcube/informationsystem/resourceregistry/ResourceInitializer.java index 79de047..8a49fd4 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ResourceInitializer.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/ResourceInitializer.java @@ -2,6 +2,7 @@ package org.gcube.informationsystem.resourceregistry; import javax.ws.rs.ApplicationPath; +import org.gcube.informationsystem.resourceregistry.rest.Access; import org.glassfish.jersey.server.ResourceConfig; /** @@ -11,7 +12,7 @@ import org.glassfish.jersey.server.ResourceConfig; public class ResourceInitializer extends ResourceConfig { public ResourceInitializer(){ - packages("org.gcube.informationsystem.resourceregistry.resources"); + packages(Access.class.getPackage().toString()); } } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java new file mode 100644 index 0000000..4d6bbe7 --- /dev/null +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java @@ -0,0 +1,29 @@ +/** + * + */ +package org.gcube.informationsystem.resourceregistry.context; + +import java.util.UUID; + +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; + +/** + * @author Luca Frosini (ISTI - CNR) + */ +public interface ContextManagement { + + public String create(UUID parentContext, String name) throws ContextCreationException, ResourceRegistryException; + + public String read(UUID context) throws ContextNotFoundException, ContextException; + + public String rename(UUID context, String newName) throws ContextNotFoundException, ContextException; + + public String move(UUID newParent, UUID contextToMove) throws ContextNotFoundException, ContextException; + + public boolean delete(UUID context) throws ContextNotFoundException, ContextException; + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java similarity index 95% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImpl.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java index 2d5edbd..629c8a0 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImpl.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.context; import java.util.Iterator; import java.util.UUID; @@ -9,16 +9,13 @@ import java.util.UUID; import org.gcube.informationsystem.model.embedded.Header; import org.gcube.informationsystem.model.entity.Context; import org.gcube.informationsystem.model.relation.IsParentOf; -import org.gcube.informationsystem.resourceregistry.api.ContextManagement; 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.context.SecurityContext; -import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode; -import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderUtility; -import org.gcube.informationsystem.resourceregistry.resources.utils.Utility; +import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java index aa82e0f..ef36fe2 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java @@ -112,7 +112,7 @@ public class DatabaseIntializator { public static void createEntitiesAndRelations() throws Exception { ERDiscovery erDiscovery = Entities.getErdiscovery(); - EntityRegistrationAction entityRegistrationAction = new EntityRegistrationAction(); + SchemaActionImpl entityRegistrationAction = new SchemaActionImpl(); entityRegistrationAction.manageEmbeddedClass(Embedded.class); entityRegistrationAction.manageEmbeddedClass(ValueSchema.class); erDiscovery.manageDiscoveredERTypes(entityRegistrationAction); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/EntityRegistrationAction.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java similarity index 85% rename from src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/EntityRegistrationAction.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java index f4924ce..4c5ea3a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/EntityRegistrationAction.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java @@ -3,7 +3,7 @@ */ package org.gcube.informationsystem.resourceregistry.dbinitialization; -import org.gcube.informationsystem.impl.utils.discovery.ERAction; +import org.gcube.informationsystem.impl.utils.discovery.SchemaAction; import org.gcube.informationsystem.model.embedded.Embedded; import org.gcube.informationsystem.model.entity.Entity; import org.gcube.informationsystem.model.entity.Facet; @@ -11,8 +11,8 @@ import org.gcube.informationsystem.model.entity.Resource; import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.model.relation.Relation; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; -import org.gcube.informationsystem.resourceregistry.resources.impl.SchemaManagementImpl; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.gcube.informationsystem.types.TypeBinder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,14 +21,14 @@ import org.slf4j.LoggerFactory; /** * @author Luca Frosini (ISTI - CNR) */ -public class EntityRegistrationAction implements ERAction { +public class SchemaActionImpl implements SchemaAction { - private static Logger logger = LoggerFactory.getLogger(EntityRegistrationAction.class); + private static Logger logger = LoggerFactory.getLogger(SchemaActionImpl.class); protected SchemaManagement schemaManagement; - public EntityRegistrationAction(){ + public SchemaActionImpl(){ this.schemaManagement = new SchemaManagementImpl(); } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java index 63db996..2363eb1 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java @@ -11,8 +11,8 @@ import org.gcube.informationsystem.model.embedded.Embedded; import org.gcube.informationsystem.model.embedded.Header; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; -import org.gcube.informationsystem.resourceregistry.resources.impl.SchemaManagementImpl; -import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; +import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java index d17381c..71469ce 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java @@ -24,10 +24,10 @@ import org.gcube.informationsystem.resourceregistry.context.SecurityContextMappe import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode; import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.relation.RelationManagement; -import org.gcube.informationsystem.resourceregistry.resources.impl.SchemaManagementImpl; -import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility; -import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderUtility; -import org.gcube.informationsystem.resourceregistry.resources.utils.Utility; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; +import org.gcube.informationsystem.resourceregistry.utils.ContextUtility; +import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java index e909f12..a9877f7 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java @@ -9,7 +9,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; -import org.gcube.informationsystem.resourceregistry.resources.utils.Utility; +import org.gcube.informationsystem.resourceregistry.utils.Utility; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.orient.OrientGraph; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java index 33b0464..883869a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java @@ -18,7 +18,7 @@ import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.relation.ConsistsOfManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.relation.IsRelatedToManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.relation.RelationManagement; -import org.gcube.informationsystem.resourceregistry.resources.utils.Utility; +import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java index a7bc41a..1b7c77e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java @@ -31,10 +31,10 @@ import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.entity.EntityManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; -import org.gcube.informationsystem.resourceregistry.resources.impl.SchemaManagementImpl; -import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility; -import org.gcube.informationsystem.resourceregistry.resources.utils.HeaderUtility; -import org.gcube.informationsystem.resourceregistry.resources.utils.Utility; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; +import org.gcube.informationsystem.resourceregistry.utils.ContextUtility; +import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; +import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java new file mode 100644 index 0000000..c1ea386 --- /dev/null +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/Query.java @@ -0,0 +1,25 @@ +/** + * + */ +package org.gcube.informationsystem.resourceregistry.query; + +import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; + +/** + * @author Luca Frosini (ISTI - CNR) + * + */ +public interface Query { + + /** + * @param query + * @param limit + * @param fetchPlan + * @return + * @throws InvalidQueryException + * http://orientdb.com/docs/last/OrientDB-REST.html#query + */ + public String query(String query, int limit, String fetchPlan) + throws InvalidQueryException; + +} diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java similarity index 94% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImpl.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java index 0825e38..0a4acdd 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/query/QueryImpl.java @@ -1,17 +1,16 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.query; import java.io.StringWriter; import java.io.Writer; import java.util.List; -import org.gcube.informationsystem.resourceregistry.api.Query; import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode; -import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility; -import org.gcube.informationsystem.resourceregistry.resources.utils.Utility; +import org.gcube.informationsystem.resourceregistry.utils.ContextUtility; +import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java similarity index 78% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/Access.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index cce49f9..7234cb1 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -1,4 +1,4 @@ -package org.gcube.informationsystem.resourceregistry.resources; +package org.gcube.informationsystem.resourceregistry.rest; import java.util.UUID; @@ -9,18 +9,19 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; -import org.gcube.informationsystem.resourceregistry.api.Query; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; +import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; -import org.gcube.informationsystem.resourceregistry.resources.impl.QueryImpl; -import org.gcube.informationsystem.resourceregistry.resources.impl.SchemaManagementImpl; +import org.gcube.informationsystem.resourceregistry.query.Query; +import org.gcube.informationsystem.resourceregistry.query.QueryImpl; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -101,7 +102,8 @@ public class Access { SchemaManagement schemaManager = new SchemaManagementImpl(); return schemaManager.getFacetSchema(facetType); } - + + /** * e.g. GET /resource-registry/access/resource/instance/cc132a2c-d0b0-45a8-92fa-7451f6a44b6d * @param resourceId @@ -136,4 +138,26 @@ public class Access { return schemaManager.getResourceSchema(resourceType); } + + public String getResourceTypes(String resourceType, boolean includeSchema) throws SchemaNotFoundException, SchemaException { + throw new UnsupportedOperationException("Not Yet implemented"); + } + + public String getEmbeddedTypes(String embeddedType, boolean includeSchema) throws SchemaNotFoundException, SchemaException { + throw new UnsupportedOperationException("Not Yet implemented"); + } + + + public String getRelationTypes(String relationType, boolean includeSchema) throws SchemaNotFoundException, SchemaException { + throw new UnsupportedOperationException("Not Yet implemented"); + } + + public String getConsistsOfTypes(String consistsOfType, boolean includeSchema) throws SchemaNotFoundException, SchemaException { + throw new UnsupportedOperationException("Not Yet implemented"); + } + + public String getIsRelatedToTypes(String isRelatedToType, boolean includeSchema) throws SchemaNotFoundException, SchemaException { + throw new UnsupportedOperationException("Not Yet implemented"); + } + } \ No newline at end of file diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/ContextManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java similarity index 94% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/ContextManager.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java index 78eaf9a..bb59ebd 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/ContextManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources; +package org.gcube.informationsystem.resourceregistry.rest; import java.util.UUID; @@ -14,13 +14,13 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; -import org.gcube.informationsystem.resourceregistry.api.ContextManagement; 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.rest.ContextPath; -import org.gcube.informationsystem.resourceregistry.resources.impl.ContextManagementImpl; +import org.gcube.informationsystem.resourceregistry.context.ContextManagement; +import org.gcube.informationsystem.resourceregistry.context.ContextManagementImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java similarity index 98% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java index 1dd8e21..719d17a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/EntityManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java @@ -1,4 +1,4 @@ -package org.gcube.informationsystem.resourceregistry.resources; +package org.gcube.informationsystem.resourceregistry.rest; import java.util.UUID; @@ -25,7 +25,7 @@ import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetMan import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.relation.ConsistsOfManagement; import org.gcube.informationsystem.resourceregistry.ermanagement.relation.IsRelatedToManagement; -import org.gcube.informationsystem.resourceregistry.resources.utils.ContextUtility; +import org.gcube.informationsystem.resourceregistry.utils.ContextUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory; * @author Lucio Lelii (ISTI - CNR) */ @Path(EntityPath.ENTITY_PATH_PART) -public class EntityManager { +public class ERManager { private static Logger logger = LoggerFactory.getLogger(SchemaManager.class); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/ResourceRegistryExceptionMapper.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ResourceRegistryExceptionMapper.java similarity index 94% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/ResourceRegistryExceptionMapper.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/rest/ResourceRegistryExceptionMapper.java index 8670d77..f23d3ce 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/ResourceRegistryExceptionMapper.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ResourceRegistryExceptionMapper.java @@ -1,4 +1,4 @@ -package org.gcube.informationsystem.resourceregistry.resources; +package org.gcube.informationsystem.resourceregistry.rest; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/SchemaManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java similarity index 94% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/SchemaManager.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java index 9951b02..5396340 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/SchemaManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java @@ -1,4 +1,4 @@ -package org.gcube.informationsystem.resourceregistry.resources; +package org.gcube.informationsystem.resourceregistry.rest; import javax.ws.rs.ApplicationPath; import javax.ws.rs.Consumes; @@ -12,10 +12,10 @@ import org.gcube.informationsystem.model.entity.Facet; import org.gcube.informationsystem.model.entity.Resource; import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.model.relation.IsRelatedTo; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.rest.SchemaPath; -import org.gcube.informationsystem.resourceregistry.resources.impl.SchemaManagementImpl; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -131,5 +131,8 @@ public class SchemaManager { IsRelatedTo.NAME, jsonSchema); return schemaManager.registerIsRelatedToSchema(jsonSchema); } + + + } diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java new file mode 100644 index 0000000..b66e374 --- /dev/null +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java @@ -0,0 +1,97 @@ +package org.gcube.informationsystem.resourceregistry.schema; + +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) + * + * 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 getEntityTypes(String entityType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + + + 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 getFacetTypes(String facetType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + + + + 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 getResourceTypes(String resourceType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + + + + 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 getEmbeddedTypes(String embeddedType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + + + + 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 getRelationTypes(String relationType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + + + + public String registerConsistsOfSchema(String jsonSchema) throws SchemaException; + + public String getConsistsOfSchema(String consistsOfType) throws SchemaNotFoundException; + + public String updateConsistsOfSchema(String consistsOfType, String jsonSchema) throws SchemaNotFoundException, SchemaException; + + public String deleteConsistsOfSchema(String consistsOfType) throws SchemaException; + + public String getConsistsOfTypes(String consistsOfType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + + + + public String registerIsRelatedToSchema(String jsonSchema) throws SchemaException; + + public String getIsRelatedToSchema(String isRelatedToType) throws SchemaNotFoundException; + + public String updateIsRelatedToSchema(String isRelatedToType, String jsonSchema) throws SchemaNotFoundException, SchemaException; + + public String deleteIsRelatedToSchema(String isRelatedToType) throws SchemaException; + + public String getIsRelatedToTypes(String isRelatedToType, boolean includeSchema) throws SchemaNotFoundException, SchemaException; + +} diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java similarity index 99% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java index c8fe228..6ce6b8d 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.schema; import java.util.ArrayList; import java.util.Collection; @@ -18,7 +18,6 @@ import org.gcube.informationsystem.model.entity.Resource; import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.model.relation.Relation; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/ContextUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/ContextUtility.java similarity index 99% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/ContextUtility.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/utils/ContextUtility.java index 8d3aeef..d383d40 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/ContextUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/ContextUtility.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.utils; +package org.gcube.informationsystem.resourceregistry.utils; import java.util.Iterator; import java.util.UUID; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderOrient.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java similarity index 94% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderOrient.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java index e8dc57f..e949835 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderOrient.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.utils; +package org.gcube.informationsystem.resourceregistry.utils; import java.util.Date; import java.util.UUID; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java similarity index 97% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java index a431265..290118b 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/HeaderUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.utils; +package org.gcube.informationsystem.resourceregistry.utils; import java.io.IOException; import java.text.SimpleDateFormat; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/Utility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java similarity index 98% rename from src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/Utility.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java index 9c22dae..1f97d60 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/utils/Utility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.utils; +package org.gcube.informationsystem.resourceregistry.utils; import java.util.HashSet; import java.util.Iterator; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/QueryManagerFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java similarity index 69% rename from src/test/java/org/gcube/informationsystem/resourceregistry/QueryManagerFactory.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java index 42b8381..e84e405 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/QueryManagerFactory.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java @@ -1,20 +1,20 @@ package org.gcube.informationsystem.resourceregistry; -import org.gcube.informationsystem.resourceregistry.api.Query; import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; +import org.gcube.informationsystem.resourceregistry.rest.Access; import org.glassfish.hk2.api.Factory; -public class QueryManagerFactory implements Factory{ +public class AccessManagerFactory implements Factory{ @Override - public void dispose(Query arg0) { + public void dispose(Access arg0) { // TODO Auto-generated method stub } @Override - public Query provide() { - return new Query() { + public Access provide() { + return new Access() { @Override public String query(String query, int limit, String fetchPlan) throws InvalidQueryException { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java index 00f2e88..8ebf91b 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java @@ -2,10 +2,10 @@ package org.gcube.informationsystem.resourceregistry; import java.util.UUID; -import org.gcube.informationsystem.resourceregistry.api.ContextManagement; 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.context.ContextManagement; import org.glassfish.hk2.api.Factory; public class ContextManagerFactory implements Factory { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/EntityManagementFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/EntityManagementFactory.java deleted file mode 100644 index bf920a9..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/EntityManagementFactory.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.gcube.informationsystem.resourceregistry; - -import java.util.UUID; - -import org.gcube.informationsystem.resourceregistry.api.EntityManagement; -import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; -import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; -import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; -import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; -import org.glassfish.hk2.api.Factory; - -public class EntityManagementFactory implements Factory { - - @Override - public void dispose(EntityManagement arg0) { - // TODO Auto-generated method stub - } - - @Override - public EntityManagement provide() { - return new EntityManagement() { - - @Override - public String updateFacet(UUID uuid, String jsonRepresentation) - throws FacetNotFoundException { - return null; - } - - @Override - public String readResource(UUID uuid) - throws ResourceNotFoundException { - return "resource"; - } - - @Override - public String readFacet(UUID uuid) throws FacetNotFoundException { - return "facet"; - } - - @Override - public boolean deleteResource(UUID uuid) - throws ResourceNotFoundException, ResourceRegistryException { - return false; - } - - @Override - public boolean deleteFacet(UUID uuid) - throws FacetNotFoundException, ResourceRegistryException { - return false; - } - - @Override - public String createResource(String resourceType, - String jsonRepresentation) throws ResourceRegistryException { - return null; - } - - @Override - public String createFacet(String facetType, - String jsonRepresentation) throws ResourceRegistryException { - return null; - } - - @Override - public String attachResource(UUID sourceResourceUuid, - UUID targetResourceUuid, String relatedToType, - String jsonProperties) throws ResourceNotFoundException, - ResourceRegistryException { - return null; - } - - @Override - public String attachFacet(UUID resourceUuid, UUID facetUuid, - String consistOfType, String jsonProperties) - throws FacetNotFoundException, ResourceNotFoundException, - ResourceRegistryException { - return null; - } - - @Override - public String readFacet(UUID uuid, String facetType) - throws FacetNotFoundException, ResourceRegistryException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String readResource(UUID uuid, String resourceType) - throws ResourceNotFoundException, ResourceRegistryException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean detachFacet(UUID consistOfUUID) - throws ResourceRegistryException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean detachResource(UUID relatedToUUID) - throws ResourceRegistryException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean addResourceToContext(UUID uuid) - throws ResourceNotFoundException, ContextNotFoundException, - ResourceRegistryException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean addFacetToContext(UUID uuid) - throws FacetNotFoundException, ContextNotFoundException, - ResourceRegistryException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String updateResource(UUID resourceUUID, - String jsonRepresentation) - throws ResourceNotFoundException, ResourceRegistryException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean removeResourceFromContext(UUID uuid) - throws ResourceNotFoundException, ContextNotFoundException, - ResourceRegistryException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean removeFacetFromContext(UUID uuid) - throws FacetNotFoundException, ContextNotFoundException, - ResourceRegistryException { - // TODO Auto-generated method stub - return false; - } - - }; - } - -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/EntityRegistrationFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java similarity index 97% rename from src/test/java/org/gcube/informationsystem/resourceregistry/EntityRegistrationFactory.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java index cf8543a..b85b799 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/EntityRegistrationFactory.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java @@ -1,11 +1,11 @@ package org.gcube.informationsystem.resourceregistry; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; import org.glassfish.hk2.api.Factory; -public class EntityRegistrationFactory implements Factory{ +public class SchemaManagerFactory implements Factory{ @Override public void dispose(SchemaManagement arg0) { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java index fbbb231..65249c2 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java @@ -3,14 +3,13 @@ package org.gcube.informationsystem.resourceregistry.access; import javax.ws.rs.core.Application; import javax.ws.rs.core.Response; -import org.gcube.informationsystem.resourceregistry.EntityManagementFactory; -import org.gcube.informationsystem.resourceregistry.EntityRegistrationFactory; -import org.gcube.informationsystem.resourceregistry.QueryManagerFactory; -import org.gcube.informationsystem.resourceregistry.api.EntityManagement; -import org.gcube.informationsystem.resourceregistry.api.Query; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; -import org.gcube.informationsystem.resourceregistry.resources.Access; -import org.gcube.informationsystem.resourceregistry.resources.ResourceRegistryExceptionMapper; +import org.gcube.informationsystem.resourceregistry.AccessManagerFactory; +import org.gcube.informationsystem.resourceregistry.ContextManagerFactory; +import org.gcube.informationsystem.resourceregistry.SchemaManagerFactory; +import org.gcube.informationsystem.resourceregistry.context.ContextManagement; +import org.gcube.informationsystem.resourceregistry.rest.Access; +import org.gcube.informationsystem.resourceregistry.rest.ResourceRegistryExceptionMapper; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; @@ -25,9 +24,9 @@ public class AccessTest extends JerseyTest{ AbstractBinder binder = new AbstractBinder() { @Override protected void configure() { - bindFactory(EntityManagementFactory.class).to(EntityManagement.class); - bindFactory(QueryManagerFactory.class).to(Query.class); - bindFactory(EntityRegistrationFactory.class).to(SchemaManagement.class); + bindFactory(ContextManagerFactory.class).to(ContextManagement.class); + bindFactory(AccessManagerFactory.class).to(Access.class); + bindFactory(SchemaManagerFactory.class).to(SchemaManagement.class); } }; ResourceConfig config = new ResourceConfig(Access.class, ResourceRegistryExceptionMapper.class); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java index 0956359..c9b7a76 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java @@ -5,9 +5,8 @@ import javax.ws.rs.core.Application; import javax.ws.rs.core.Response; import org.gcube.informationsystem.resourceregistry.ContextManagerFactory; -import org.gcube.informationsystem.resourceregistry.api.ContextManagement; -import org.gcube.informationsystem.resourceregistry.resources.ContextManager; -import org.gcube.informationsystem.resourceregistry.resources.ResourceRegistryExceptionMapper; +import org.gcube.informationsystem.resourceregistry.rest.ContextManager; +import org.gcube.informationsystem.resourceregistry.rest.ResourceRegistryExceptionMapper; import org.glassfish.hk2.utilities.binding.AbstractBinder; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.test.JerseyTest; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/entitymanager/EntityManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/entitymanager/EntityManagementTest.java deleted file mode 100644 index 5f0d247..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/entitymanager/EntityManagementTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.gcube.informationsystem.resourceregistry.entitymanager; - -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.Response; - -import org.gcube.informationsystem.resourceregistry.EntityManagementFactory; -import org.gcube.informationsystem.resourceregistry.api.EntityManagement; -import org.gcube.informationsystem.resourceregistry.resources.EntityManager; -import org.gcube.informationsystem.resourceregistry.resources.ResourceRegistryExceptionMapper; -import org.glassfish.hk2.utilities.binding.AbstractBinder; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Assert; -import org.junit.Test; -public class EntityManagementTest extends JerseyTest{ - - @Override - protected Application configure() { - AbstractBinder binder = new AbstractBinder() { - @Override - protected void configure() { - bindFactory(EntityManagementFactory.class).to(EntityManagement.class); - } - }; - ResourceConfig config = new ResourceConfig(EntityManager.class, ResourceRegistryExceptionMapper.class); - config.register(binder); - return config; - } - - @Test - public void createFacet(){ - Response response = target("entity").path("facet").path("facetType").request().put(Entity.text(new String("{fake facet creation}")), Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void createResource(){ - Response response = target("entity").path("resource").path("resourceType").request().put(Entity.text(new String("{fake resource creation}")), Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void deleteFacet(){ - Response response = target("entity").path("facet").path("facetId").request().delete(Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void deleteResource(){ - Response response = target("entity").path("resource").path("resourceId").request().delete(Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void attachFacet(){ - Response response = target("entity").path("resource").path("resourceId").path("facet").path("facetId").request().put(Entity.text(new String("{Relation Properties}")), Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void attachResource(){ - Response response = target("entity").path("resource/source").path("sourceResourceId").path("target").path("targetResourceId").request().put(Entity.text(new String("{Relation Properties}")), Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void detachFacet(){ - Response response = target("entity").path("resource").path("resourceId").path("facet").path("facetId").request().delete(Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } - - @Test - public void detachResource(){ - Response response = target("entity").path("resource/source").path("sourceResourceId").path("target").path("targetResourceId").request().delete(Response.class); - Assert.assertEquals(Response.Status.OK.getFamily(), response.getStatusInfo().getFamily()); - } -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java index bad3271..f8c83ad 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java @@ -11,6 +11,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis 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.context.ContextManagementImpl; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java index ad080ed..5c9e041 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java @@ -5,6 +5,7 @@ package org.gcube.informationsystem.resourceregistry.resources.impl; import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; +import org.gcube.informationsystem.resourceregistry.query.QueryImpl; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java index fe16091..d6509a0 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java @@ -3,6 +3,8 @@ */ package org.gcube.informationsystem.resourceregistry.resources.impl; +import java.util.List; + import org.gcube.informationsystem.model.embedded.AccessPolicy; import org.gcube.informationsystem.model.embedded.Embedded; import org.gcube.informationsystem.model.embedded.Header; @@ -15,12 +17,17 @@ import org.gcube.informationsystem.model.relation.ConsistsOf; import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.model.relation.Relation; import org.gcube.informationsystem.model.relation.isrelatedto.Hosts; -import org.gcube.informationsystem.resourceregistry.api.SchemaManagement; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; +import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.gcube.informationsystem.types.TypeBinder; +import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + /** * @author Luca Frosini (ISTI - CNR) */ @@ -55,6 +62,8 @@ public class SchemaManagementImplTest { public void getFacetSchema() throws Exception{ String json = new SchemaManagementImpl().getFacetSchema(ContactFacet.NAME); logger.trace(json); + TypeDefinition typeDefinition = TypeBinder.deserializeTypeDefinition(json); + logger.trace(typeDefinition.toString()); } @Test @@ -99,6 +108,11 @@ public class SchemaManagementImplTest { String list = schemaManagement.getEmbeddedTypes(Embedded.NAME, includeSchema); logger.debug("{} list : {}", Embedded.NAME, list); + ObjectMapper mapper = new ObjectMapper(); + List typeDefinitions = mapper.readValue(list, new TypeReference>(){}); + logger.debug("{}", typeDefinitions); + + list = schemaManagement.getEntityTypes(Entity.NAME, includeSchema); logger.debug("{} list : {}", Entity.NAME, list);