|
|
|
@ -16,7 +16,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|
|
|
|
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.TypeMapper;
|
|
|
|
|
import org.gcube.informationsystem.types.reference.Type;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
@ -39,10 +39,10 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
|
|
|
|
public <E extends Element> Type create(Class<E> clz)
|
|
|
|
|
throws SchemaException, ResourceRegistryException {
|
|
|
|
|
try {
|
|
|
|
|
String typeDefinition = TypeBinder.serializeType(clz);
|
|
|
|
|
String typeDefinition = TypeMapper.serializeType(clz);
|
|
|
|
|
// String type = AccessType.getAccessType(clz).getName();
|
|
|
|
|
String res = create(typeDefinition);
|
|
|
|
|
return TypeBinder.deserializeTypeDefinition(res);
|
|
|
|
|
return TypeMapper.deserializeTypeDefinition(res);
|
|
|
|
|
} catch(ResourceRegistryException e) {
|
|
|
|
|
throw e;
|
|
|
|
|
} catch(Exception e) {
|
|
|
|
@ -54,7 +54,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
|
|
|
|
public String create(String typeDefinitition) throws ContextAlreadyPresentException, ResourceRegistryException {
|
|
|
|
|
try {
|
|
|
|
|
logger.trace("Going to create: {}", typeDefinitition);
|
|
|
|
|
Type typeDefinitionObj = TypeBinder.deserializeTypeDefinition(typeDefinitition);
|
|
|
|
|
Type typeDefinitionObj = TypeMapper.deserializeTypeDefinition(typeDefinitition);
|
|
|
|
|
|
|
|
|
|
GXHTTPStringRequest gxHTTPStringRequest = GXHTTPStringRequest.newRequest(address);
|
|
|
|
|
gxHTTPStringRequest.from(ResourceRegistrySchemaClient.class.getSimpleName());
|
|
|
|
@ -83,7 +83,7 @@ public class ResourceRegistrySchemaClientImpl implements ResourceRegistrySchemaC
|
|
|
|
|
try {
|
|
|
|
|
String typeName = Utility.getTypeName(clz);
|
|
|
|
|
String res = read(typeName, polymorphic);
|
|
|
|
|
return TypeBinder.deserializeTypeDefinitions(res);
|
|
|
|
|
return TypeMapper.deserializeTypeDefinitions(res);
|
|
|
|
|
} catch(ResourceRegistryException e) {
|
|
|
|
|
throw e;
|
|
|
|
|
} catch(Exception e) {
|
|
|
|
|