From aea74940060d8792a6559a2bd7fabe4ae8dfb500 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 25 Oct 2019 17:44:44 +0200 Subject: [PATCH] Fixing imports and code to be aligned with model reorganization --- .classpath | 2 +- .settings/org.eclipse.jdt.core.prefs | 3 +++ .../schema/ResourceRegistrySchemaClient.java | 8 ++++---- .../schema/ResourceRegistrySchemaClientImpl.java | 12 ++++++------ .../schema/ResourceRegistrySchemaClientTest.java | 13 +++++++------ 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.classpath b/.classpath index 8e795b1..fae1a2b 100644 --- a/.classpath +++ b/.classpath @@ -22,7 +22,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 4ede96d..714351a 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,2 +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/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClient.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClient.java index aaa1dfb..0c34042 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClient.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClient.java @@ -2,25 +2,25 @@ package org.gcube.informationsystem.resourceregistry.schema; import java.util.List; -import org.gcube.informationsystem.model.reference.ISManageable; +import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; -import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; +import org.gcube.informationsystem.types.reference.TypeDefinition; /** * @author Luca Frosini (ISTI - CNR) */ public interface ResourceRegistrySchemaClient { - public TypeDefinition create(Class clz) + public TypeDefinition create(Class clz) throws SchemaException, ResourceRegistryException; public String create(String baseType, String typeDefinitition) throws SchemaException, ResourceRegistryException; - public List read(Class clz, Boolean polymorphic) + public List> read(Class clz, Boolean polymorphic) throws SchemaNotFoundException, ResourceRegistryException; public String read(String type, Boolean polymorphic) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientImpl.java index 53d8911..011987a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientImpl.java @@ -7,8 +7,8 @@ import java.util.Map; import org.gcube.common.gxhttp.reference.GXConnection; import org.gcube.common.gxhttp.request.GXHTTPStringRequest; -import org.gcube.informationsystem.model.reference.AccessType; -import org.gcube.informationsystem.model.reference.ISManageable; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; @@ -18,7 +18,7 @@ import org.gcube.informationsystem.resourceregistry.api.rest.TypePath; import org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility; import org.gcube.informationsystem.resourceregistry.api.utils.Utility; import org.gcube.informationsystem.types.TypeBinder; -import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; +import org.gcube.informationsystem.types.reference.TypeDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC } @Override - public TypeDefinition create(Class clz) + public TypeDefinition create(Class clz) throws SchemaException, ResourceRegistryException { try { String typeDefinition = TypeBinder.serializeType(clz); @@ -55,7 +55,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC public String create(String baseType, String typeDefinitition) throws ContextAlreadyPresentException, ResourceRegistryException { try { logger.trace("Going to create: {}", typeDefinitition); - TypeDefinition typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition); + TypeDefinition typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition); GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address); gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName()); @@ -79,7 +79,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC @Override - public List read(Class clz, Boolean polymorphic) + public List> read(Class clz, Boolean polymorphic) throws SchemaNotFoundException, ResourceRegistryException { try { String type = Utility.getType(clz); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientTest.java index 52ec9dd..676a6e9 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/schema/ResourceRegistrySchemaClientTest.java @@ -2,10 +2,11 @@ package org.gcube.informationsystem.resourceregistry.schema; import java.util.List; +import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.types.TypeBinder; -import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; import org.gcube.informationsystem.types.annotations.Abstract; +import org.gcube.informationsystem.types.reference.TypeDefinition; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; @@ -25,23 +26,23 @@ public class ResourceRegistrySchemaClientTest extends ContextTest { // @Test public void testCreate() throws Exception { ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create(); - TypeDefinition td = resourceRegistrySchemaClient.create(AuxFacet.class); + TypeDefinition td = resourceRegistrySchemaClient.create(AuxFacet.class); logger.debug("{}", td); } @Test public void testRead() throws Exception { ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create(); - List types = resourceRegistrySchemaClient.read(Facet.class, true); + List> types = resourceRegistrySchemaClient.read(Facet.class, true); Assert.assertTrue(types.size()>1); - for(TypeDefinition td : types) { + for(TypeDefinition td : types) { logger.debug("{}", td); } types = resourceRegistrySchemaClient.read(Facet.class, false); Assert.assertTrue(types.size()==1); - TypeDefinition gotFacetDefinition = types.get(0); - TypeDefinition facetDefinition = TypeBinder.createTypeDefinition(Facet.class); + TypeDefinition gotFacetDefinition = types.get(0); + TypeDefinition facetDefinition = TypeBinder.createTypeDefinition(Facet.class); Assert.assertTrue(gotFacetDefinition.getName().compareTo(facetDefinition.getName())==0);