Fixing imports and code to be aligned with model reorganization
This commit is contained in:
parent
0207572463
commit
aea7494006
|
@ -22,7 +22,7 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <ISM extends ISManageable> TypeDefinition create(Class<ISM> clz)
|
||||
public <ISM extends ISManageable> TypeDefinition<ISM> create(Class<ISM> clz)
|
||||
throws SchemaException, ResourceRegistryException;
|
||||
|
||||
public String create(String baseType, String typeDefinitition)
|
||||
throws SchemaException, ResourceRegistryException;
|
||||
|
||||
|
||||
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
||||
public <ISM extends ISManageable> List<TypeDefinition<ISM>> read(Class<ISM> clz, Boolean polymorphic)
|
||||
throws SchemaNotFoundException, ResourceRegistryException;
|
||||
|
||||
public String read(String type, Boolean polymorphic)
|
||||
|
|
|
@ -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 <ISM extends ISManageable> TypeDefinition create(Class<ISM> clz)
|
||||
public <ISM extends ISManageable> TypeDefinition<ISM> create(Class<ISM> 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<? extends ISManageable> 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 <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
||||
public <ISM extends ISManageable> List<TypeDefinition<ISM>> read(Class<ISM> clz, Boolean polymorphic)
|
||||
throws SchemaNotFoundException, ResourceRegistryException {
|
||||
try {
|
||||
String type = Utility.getType(clz);
|
||||
|
|
|
@ -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<? extends ISManageable> td = resourceRegistrySchemaClient.create(AuxFacet.class);
|
||||
logger.debug("{}", td);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRead() throws Exception {
|
||||
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
||||
List<TypeDefinition> types = resourceRegistrySchemaClient.read(Facet.class, true);
|
||||
List<TypeDefinition<Facet>> types = resourceRegistrySchemaClient.read(Facet.class, true);
|
||||
Assert.assertTrue(types.size()>1);
|
||||
for(TypeDefinition td : types) {
|
||||
for(TypeDefinition<Facet> 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<Facet> gotFacetDefinition = types.get(0);
|
||||
TypeDefinition<Facet> facetDefinition = TypeBinder.createTypeDefinition(Facet.class);
|
||||
|
||||
|
||||
Assert.assertTrue(gotFacetDefinition.getName().compareTo(facetDefinition.getName())==0);
|
||||
|
|
Loading…
Reference in New Issue