Aligned APIs with IS model refactoring
This commit is contained in:
parent
c0517db9b8
commit
2c4950a6fb
|
@ -13,14 +13,13 @@ import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||||
*/
|
*/
|
||||||
public interface ResourceRegistrySchemaClient {
|
public interface ResourceRegistrySchemaClient {
|
||||||
|
|
||||||
public <ISM extends ISManageable> TypeDefinition<ISM> create(Class<ISM> clz)
|
public <ISM extends ISManageable> TypeDefinition create(Class<ISM> clz)
|
||||||
throws SchemaException, ResourceRegistryException;
|
throws SchemaException, ResourceRegistryException;
|
||||||
|
|
||||||
public String create(String baseType, String typeDefinitition)
|
public String create(String baseType, String typeDefinitition)
|
||||||
throws SchemaException, ResourceRegistryException;
|
throws SchemaException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
||||||
throws SchemaNotFoundException, ResourceRegistryException;
|
throws SchemaNotFoundException, ResourceRegistryException;
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,8 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public <ISM extends ISManageable> TypeDefinition<ISM> create(Class<ISM> clz)
|
public <ISM extends ISManageable> TypeDefinition create(Class<ISM> clz)
|
||||||
throws SchemaException, ResourceRegistryException {
|
throws SchemaException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
String typeDefinition = TypeBinder.serializeType(clz);
|
String typeDefinition = TypeBinder.serializeType(clz);
|
||||||
|
@ -56,8 +55,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
||||||
public String create(String baseType, String typeDefinitition) throws ContextAlreadyPresentException, ResourceRegistryException {
|
public String create(String baseType, String typeDefinitition) throws ContextAlreadyPresentException, ResourceRegistryException {
|
||||||
try {
|
try {
|
||||||
logger.trace("Going to create: {}", typeDefinitition);
|
logger.trace("Going to create: {}", typeDefinitition);
|
||||||
@SuppressWarnings("unchecked")
|
TypeDefinition typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition);
|
||||||
TypeDefinition<? extends ISManageable> typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition);
|
|
||||||
|
|
||||||
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
||||||
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
||||||
|
@ -80,7 +78,6 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
|
||||||
@Override
|
@Override
|
||||||
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
public <ISM extends ISManageable> List<TypeDefinition> read(Class<ISM> clz, Boolean polymorphic)
|
||||||
throws SchemaNotFoundException, ResourceRegistryException {
|
throws SchemaNotFoundException, ResourceRegistryException {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.gcube.informationsystem.resourceregistry.schema;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
|
||||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||||
import org.gcube.informationsystem.types.TypeBinder;
|
import org.gcube.informationsystem.types.TypeBinder;
|
||||||
import org.gcube.informationsystem.types.annotations.Abstract;
|
import org.gcube.informationsystem.types.annotations.Abstract;
|
||||||
|
@ -26,11 +25,10 @@ public class ResourceRegistrySchemaClientTest extends ContextTest {
|
||||||
// @Test
|
// @Test
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() throws Exception {
|
||||||
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
||||||
TypeDefinition<? extends ISManageable> td = resourceRegistrySchemaClient.create(AuxFacet.class);
|
TypeDefinition td = resourceRegistrySchemaClient.create(AuxFacet.class);
|
||||||
logger.debug("{}", td);
|
logger.debug("{}", td);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() throws Exception {
|
public void testRead() throws Exception {
|
||||||
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
ResourceRegistrySchemaClient resourceRegistrySchemaClient = ResourceRegistrySchemaClientFactory.create();
|
||||||
|
@ -42,8 +40,8 @@ public class ResourceRegistrySchemaClientTest extends ContextTest {
|
||||||
|
|
||||||
types = resourceRegistrySchemaClient.read(Facet.class, false);
|
types = resourceRegistrySchemaClient.read(Facet.class, false);
|
||||||
Assert.assertTrue(types.size()==1);
|
Assert.assertTrue(types.size()==1);
|
||||||
TypeDefinition<Facet> gotFacetDefinition = types.get(0);
|
TypeDefinition gotFacetDefinition = types.get(0);
|
||||||
TypeDefinition<Facet> facetDefinition = TypeBinder.createTypeDefinition(Facet.class);
|
TypeDefinition facetDefinition = TypeBinder.createTypeDefinition(Facet.class);
|
||||||
|
|
||||||
|
|
||||||
Assert.assertTrue(gotFacetDefinition.getName().compareTo(facetDefinition.getName())==0);
|
Assert.assertTrue(gotFacetDefinition.getName().compareTo(facetDefinition.getName())==0);
|
||||||
|
|
Loading…
Reference in New Issue