TypeBinder has been renamed to TypeMapper
This commit is contained in:
parent
69647bbc32
commit
aa72d03b4f
|
@ -28,7 +28,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.SchemaSecu
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.properties.PropertyTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.gcube.informationsystem.types.reference.Type;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
|
@ -261,7 +261,7 @@ public class DatabaseEnvironment {
|
|||
schemaToBeCreated.add(Header.class);
|
||||
for(Class<? extends Element> clz : schemaToBeCreated) {
|
||||
ElementManagement<? extends OElement> erManagement = new PropertyTypeDefinitionManagement();
|
||||
erManagement.setJson(TypeBinder.serializeType(clz));
|
||||
erManagement.setJson(TypeMapper.serializeType(clz));
|
||||
erManagement.create();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
|||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.types.SchemaManagementImpl;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.gcube.informationsystem.utils.discovery.SchemaAction;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -29,8 +29,8 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
throws Exception {
|
||||
try {
|
||||
SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
|
||||
schemaManagement.setTypeName(TypeBinder.getType(r));
|
||||
String json = TypeBinder.serializeType(r);
|
||||
schemaManagement.setTypeName(TypeMapper.getType(r));
|
||||
String json = TypeMapper.serializeType(r);
|
||||
logger.trace(json);
|
||||
if(ConsistsOf.class.isAssignableFrom(r)) {
|
||||
schemaManagement.create(json, AccessType.CONSISTS_OF);
|
||||
|
@ -40,7 +40,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
schemaManagement.create(json, AccessType.RELATION_ELEMENT);
|
||||
}
|
||||
} catch(SchemaAlreadyPresentException sape) {
|
||||
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r));
|
||||
logger.warn("{} already exists. It will be ignored", TypeMapper.getType(r));
|
||||
} catch(Exception ex) {
|
||||
logger.error("Error creating schema for {} {}: {}", RelationElement.NAME, r.getSimpleName(), ex.getMessage());
|
||||
throw ex;
|
||||
|
@ -51,8 +51,8 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
public <E extends EntityElement> void manageEntityClass(Class<E> e) throws Exception {
|
||||
try {
|
||||
SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
|
||||
schemaManagement.setTypeName(TypeBinder.getType(e));
|
||||
String json = TypeBinder.serializeType(e);
|
||||
schemaManagement.setTypeName(TypeMapper.getType(e));
|
||||
String json = TypeMapper.serializeType(e);
|
||||
logger.trace(json);
|
||||
if(Facet.class.isAssignableFrom(e)) {
|
||||
schemaManagement.create(json, AccessType.FACET);
|
||||
|
@ -62,7 +62,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
schemaManagement.create(json, AccessType.ENTITY_ELEMENT);
|
||||
}
|
||||
} catch(SchemaAlreadyPresentException sape) {
|
||||
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e));
|
||||
logger.warn("{} already exists. It will be ignored", TypeMapper.getType(e));
|
||||
} catch(Exception ex) {
|
||||
logger.error("Error creating schema for {} {}: {}", EntityElement.NAME, e.getSimpleName(), ex.getMessage());
|
||||
throw ex;
|
||||
|
@ -73,8 +73,8 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
public <P extends PropertyElement> void managePropertyClass(Class<P> p) throws Exception {
|
||||
try {
|
||||
SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
|
||||
schemaManagement.setTypeName(TypeBinder.getType(p));
|
||||
String json = TypeBinder.serializeType(p);
|
||||
schemaManagement.setTypeName(TypeMapper.getType(p));
|
||||
String json = TypeMapper.serializeType(p);
|
||||
logger.trace(json);
|
||||
if(Property.class.isAssignableFrom(p)) {
|
||||
if(p.equals(Property.class) || p.equals(Header.class) ) {
|
||||
|
@ -85,7 +85,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
schemaManagement.create(json, AccessType.PROPERTY_ELEMENT);
|
||||
}
|
||||
} catch(SchemaAlreadyPresentException sape) {
|
||||
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(p));
|
||||
logger.warn("{} already exists. It will be ignored", TypeMapper.getType(p));
|
||||
} catch(Exception ex) {
|
||||
logger.error("Error creating schema for {} {}: {}", PropertyElement.NAME, p.getSimpleName(), ex.getMessage());
|
||||
throw ex;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
|
|||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.types.SchemaManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.SchemaManagementImpl;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class SchemaManager {
|
|||
AccessType accessType = null;
|
||||
String firstGotType = null;
|
||||
try {
|
||||
Set<String> superClasses = TypeBinder.deserializeTypeDefinition(json).getSuperClasses();
|
||||
Set<String> superClasses = TypeMapper.deserializeTypeDefinition(json).getSuperClasses();
|
||||
if(superClasses.size()==0) {
|
||||
throw new ResourceRegistryException("No superclasses defined");
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.gcube.informationsystem.resourceregistry.types.properties.PropertyTyp
|
|||
import org.gcube.informationsystem.resourceregistry.types.relations.ConsistsOfTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.relations.IsRelatedToTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.types.OrientDBType;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.gcube.informationsystem.types.reference.Type;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
|
@ -154,7 +154,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
}
|
||||
if(erManagement!=null) {
|
||||
String ret = erManagement.read();
|
||||
return TypeBinder.deserializeTypeDefinition(ret);
|
||||
return TypeMapper.deserializeTypeDefinition(ret);
|
||||
}else {
|
||||
throw new SchemaException("You can only request schema of IS Model types and their specilization");
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
protected String getTypeDefinitionAsString(OClass oClass) throws SchemaException {
|
||||
try {
|
||||
Type type = getType(oClass);
|
||||
return TypeBinder.serializeTypeDefinition(type);
|
||||
return TypeMapper.serializeTypeDefinition(type);
|
||||
} catch(Exception e) {
|
||||
throw new SchemaException(e);
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
}
|
||||
}
|
||||
|
||||
return TypeBinder.serializeTypeDefinitions(typeDefinitions);
|
||||
return TypeMapper.serializeTypeDefinitions(typeDefinitions);
|
||||
} catch(SchemaException e) {
|
||||
throw e;
|
||||
} catch(Exception e) {
|
||||
|
@ -411,7 +411,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
Type typeDefinition = null;
|
||||
try {
|
||||
try {
|
||||
typeDefinition = TypeBinder.deserializeTypeDefinition(jsonSchema);
|
||||
typeDefinition = TypeMapper.deserializeTypeDefinition(jsonSchema);
|
||||
logger.info("Trying to register {} {} : {}", accessType.getName(), typeDefinition.getName(),
|
||||
jsonSchema);
|
||||
} catch(Exception e) {
|
||||
|
@ -448,7 +448,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
erManagement.setJson(jsonSchema);
|
||||
ret = erManagement.create();
|
||||
}else {
|
||||
ret = TypeBinder.serializeTypeDefinition(typeDefinition);
|
||||
ret = TypeMapper.serializeTypeDefinition(typeDefinition);
|
||||
}
|
||||
return ret;
|
||||
} catch(SchemaAlreadyPresentException e) {
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnv
|
|||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.entities.EntityElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -36,7 +36,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityType> exten
|
|||
|
||||
protected EntityTypeDefinitionManagement(Class<E> clz) {
|
||||
super(AccessType.ENTITY_TYPE);
|
||||
this.elementType = TypeBinder.getType(clz);
|
||||
this.elementType = TypeMapper.getType(clz);
|
||||
}
|
||||
|
||||
protected EntityTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument, Class<E> clz) throws ResourceRegistryException {
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.ServiceLoader;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.gcube.informationsystem.utils.discovery.ElementSpecilizationDiscovery;
|
||||
import org.gcube.informationsystem.utils.discovery.RegistrationProvider;
|
||||
import org.junit.Test;
|
||||
|
@ -40,7 +40,7 @@ public class DiscoveryTest {
|
|||
}else {
|
||||
stringBuilder.append(",");
|
||||
}
|
||||
stringBuilder.append(TypeBinder.serializeType(resource));
|
||||
stringBuilder.append(TypeMapper.serializeType(resource));
|
||||
}
|
||||
stringBuilder.append("]");
|
||||
logger.debug(stringBuilder.toString());
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
|||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
|
||||
|
@ -51,7 +51,7 @@ public class SchemaManagementImplTest {
|
|||
@Test
|
||||
public void registerPropertyTypeSchema() throws Exception {
|
||||
Class<? extends PropertyElement> clz = Header.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
String json = TypeMapper.serializeType(clz);
|
||||
logger.debug(json);
|
||||
//new SchemaManagementImpl().create(json, AccessType.PROPERTY);
|
||||
}
|
||||
|
@ -65,15 +65,15 @@ public class SchemaManagementImplTest {
|
|||
@Test
|
||||
public void registerFacetSchema() throws Exception {
|
||||
Class<? extends Facet> clz = ContactFacet.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
TypeBinder.deserializeTypeDefinition(json);
|
||||
String json = TypeMapper.serializeType(clz);
|
||||
TypeMapper.deserializeTypeDefinition(json);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getFacetSchema() throws Exception {
|
||||
String json = new SchemaManagementImpl().read(ContactFacet.NAME, false);
|
||||
logger.info(json);
|
||||
List<Type> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json);
|
||||
List<Type> typeDefinitions = TypeMapper.deserializeTypeDefinitions(json);
|
||||
logger.info("{}", typeDefinitions);
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class SchemaManagementImplTest {
|
|||
@Test
|
||||
public void registerEntityTypeSchema() throws Exception {
|
||||
Class<? extends Entity> clz = Entity.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
String json = TypeMapper.serializeType(clz);
|
||||
logger.trace(json);
|
||||
// new SchemaManagementImpl().registerEntitySchema(json);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class SchemaManagementImplTest {
|
|||
@Test
|
||||
public void registerResourceSchema() throws Exception {
|
||||
Class<? extends Resource> clz = Resource.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
String json = TypeMapper.serializeType(clz);
|
||||
logger.info(json);
|
||||
// new SchemaManagementImpl().registerFacetSchema(json);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class SchemaManagementImplTest {
|
|||
@Test
|
||||
public void registerRelation() throws Exception {
|
||||
Class<? extends Element> clz = Hosts.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
String json = TypeMapper.serializeType(clz);
|
||||
logger.trace(json);
|
||||
// new SchemaManagementImpl().registerFacetSchema(json);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue