Refactored

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141497 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-01-10 13:58:13 +00:00
parent 1078b43fcf
commit 098bf95122
10 changed files with 381 additions and 657 deletions

View File

@ -11,6 +11,7 @@ import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.model.relation.Relation;
import org.gcube.informationsystem.resourceregistry.rest.AccessType;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl;
import org.gcube.informationsystem.types.TypeBinder;
@ -39,11 +40,11 @@ public class SchemaActionImpl implements SchemaAction {
String json = TypeBinder.serializeType(r);
logger.trace(json);
if (ConsistsOf.class.isAssignableFrom(r)) {
schemaManagement.registerConsistsOfSchema(json);
schemaManagement.create(json, AccessType.CONSISTS_OF);
} else if(IsRelatedTo.class.isAssignableFrom(r)){
schemaManagement.registerIsRelatedToSchema(json);
schemaManagement.create(json, AccessType.IS_RELATED_TO);
} else {
schemaManagement.registerRelationSchema(json);
schemaManagement.create(json, AccessType.RELATION);
}
} catch(Exception ex){
logger.error("Error creating schema for {} type {} : {}", Relation.NAME, r.getSimpleName(), ex.getMessage());
@ -57,11 +58,11 @@ public class SchemaActionImpl implements SchemaAction {
String json = TypeBinder.serializeType(e);
logger.trace(json);
if (Facet.class.isAssignableFrom(e)) {
schemaManagement.createFacetSchema(json);
schemaManagement.create(json, AccessType.FACET);
} else if(Resource.class.isAssignableFrom(e)){
schemaManagement.registerResourceSchema(json);
schemaManagement.create(json, AccessType.RESOURCE);
} else {
schemaManagement.createEntitySchema(json);
schemaManagement.create(json, AccessType.ENTITY);
}
} catch(Exception ex){
logger.error("Error creating schema for {} type {} : {}", Entity.NAME, e.getSimpleName(), ex.getMessage());
@ -74,7 +75,7 @@ public class SchemaActionImpl implements SchemaAction {
try {
String json = TypeBinder.serializeType(e);
logger.trace(json);
schemaManagement.registerEmbeddedTypeSchema(json);
schemaManagement.create(json, AccessType.EMBEDDED);
} catch (Exception ex) {
logger.error("Error creating schema for {} type {} : {}",
Embedded.NAME, e.getSimpleName(),

View File

@ -35,8 +35,6 @@ public abstract class EntityManagement<E extends Entity> extends
private static Logger logger = LoggerFactory
.getLogger(EntityManagement.class);
protected Vertex element;
protected EntityManagement(Class<E> entityClass) {
super(entityClass);

View File

@ -52,8 +52,6 @@ public abstract class RelationManagement<R extends Relation> extends ERManagemen
protected final Class<? extends Entity> targetEntityClass;
protected Edge element;
protected RelationManagement(Class<R> relationClass) {
super(relationClass);

View File

@ -39,9 +39,9 @@ public class Access {
public static final String ID_PATH_PARAM = "id";
public static final String TYPE_PATH_PARAM = "type";
/**
* It includeSubtypesows to query Entities and Relations in the current Context.<br />
* It includeSubtypesows to query Entities and Relations in the current
* Context.<br />
* It accepts idempotent query only.. <br />
* <br />
* For query syntax please refer to<br />
@ -76,52 +76,54 @@ public class Access {
return queryManager.query(query, limit, fetchPlan);
}
@SuppressWarnings("rawtypes")
public static ERManagement getERManagement(AccessType querableType) throws ResourceRegistryException {
public static ERManagement getERManagement(AccessType querableType)
throws ResourceRegistryException {
switch (querableType) {
case FACET:
return new FacetManagement();
case FACET:
return new FacetManagement();
case RESOURCE:
return new ResourceManagement();
case RESOURCE:
return new ResourceManagement();
case IS_RELATED_TO:
return new IsRelatedToManagement();
case IS_RELATED_TO:
return new IsRelatedToManagement();
case CONSISTS_OF:
return new ConsistsOfManagement();
case CONSISTS_OF:
return new ConsistsOfManagement();
default:
throw new ResourceRegistryException(String.format("%s is not querable", querableType.toString()));
default:
throw new ResourceRegistryException(String.format(
"%s is not querable", querableType.toString()));
}
}
/*
* e.g. GET /resource-registry/access/instance/{E-R}/4d28077b-566d-4132-b073-f4edaf61dcb9
* e.g. GET
* /resource-registry/access/instance/{E-R}/4d28077b-566d-4132-b073-
* f4edaf61dcb9
*/
@GET
@Path(AccessPath.INSTANCE_PATH_PART + "/" + "{" + TYPE_PATH_PARAM +"}"
@Path(AccessPath.INSTANCE_PATH_PART + "/" + "{" + TYPE_PATH_PARAM + "}"
+ "/{" + ID_PATH_PARAM + "}")
@Produces(MediaType.APPLICATION_JSON)
public String getInstance(
@PathParam(ID_PATH_PARAM) String type,
@PathParam(ID_PATH_PARAM) String facetId)
@PathParam(TYPE_PATH_PARAM) String type,
@PathParam(ID_PATH_PARAM) String id)
throws ResourceRegistryException {
logger.info("Requested Facet with id {}", facetId);
logger.info("Requested {} with id {}", type, id);
AccessType querableType = null;
try {
querableType = AccessType.valueOf(type);
}catch(Exception e){
} catch (Exception e) {
String error = String.format("%s is not querable", type);
throw new ResourceRegistryException(error);
}
@SuppressWarnings("rawtypes")
ERManagement erManagement = getERManagement(querableType);
erManagement.setUUID(UUID.fromString(facetId));
erManagement.setUUID(UUID.fromString(id));
return erManagement.read();
}
@ -129,195 +131,49 @@ public class Access {
* e.g. GET /resource-registry/access/instances/{E-R}?polymorphic=true
*/
@GET
@Path(AccessPath.INSTANCE_PATH_PART + "s/" + "{" + TYPE_PATH_PARAM +"}"
+ "/{" + ID_PATH_PARAM + "}")
@Path(AccessPath.INSTANCE_PATH_PART + "s/" + "{" + TYPE_PATH_PARAM + "}")
@Produces(MediaType.APPLICATION_JSON)
public String getInstances(
@PathParam(ID_PATH_PARAM) String type,
@PathParam(ID_PATH_PARAM) String facetId)
@PathParam(TYPE_PATH_PARAM) String type,
@QueryParam(AccessPath.POLYMORPHIC_PARAM) Boolean polymorphic)
throws FacetNotFoundException, ResourceRegistryException {
logger.info("Requested Facet with id {}", facetId);
logger.info("Requested {} ({}={}) instances", type, AccessPath.POLYMORPHIC_PARAM, polymorphic);
AccessType querableType = null;
try {
querableType = AccessType.valueOf(type);
}catch(Exception e){
} catch (Exception e) {
String error = String.format("%s is not querable", type);
throw new ResourceRegistryException(error);
}
// TODO
return null;
}
/*
* e.g. GET /resource-registry/access/schema/Facet/ContactFacet?
* includeSubtypes=true&
* includeSchema=true
* e.g. GET /resource-registry/access/schema/{E-R}/ContactFacet?
* polymorphic=true
*/
@GET
@Path(AccessPath.SCHEMA_PATH_PART + "/{"
+ TYPE_PATH_PARAM + "}")
@Path(AccessPath.SCHEMA_PATH_PART + "/{" + TYPE_PATH_PARAM + "}")
@Produces(MediaType.APPLICATION_JSON)
public String getSchema(@PathParam(TYPE_PATH_PARAM) String type,
@QueryParam(AccessPath.INCLUDE_SUBTYPES_PARAM) Boolean includeSubtypes,
@QueryParam(AccessPath.INCLUDE_SCHEMA_PARAM) Boolean includeSchema)
throws SchemaNotFoundException, SchemaException {
logger.info("Requested Facet Schema for type {}", type);
public String getSchema(
@PathParam(TYPE_PATH_PARAM) String type,
@QueryParam(AccessPath.POLYMORPHIC_PARAM) Boolean polymorphic)
throws SchemaNotFoundException, SchemaException, ResourceRegistryException {
logger.info("Requested Schema for type {}", type);
AccessType accessType = null;
try {
accessType = AccessType.valueOf(type);
} catch (Exception e) {
String error = String.format("Cannot get %s schema", type);
throw new ResourceRegistryException(error);
}
SchemaManagement schemaManagement = new SchemaManagementImpl();
// TODO
return schemaManagement.readFacetSchema(type, includeSubtypes,
includeSchema);
return schemaManagement.read(type, accessType, polymorphic);
}
// /*
// * e.g. GET /resource-registry/access/facet/instance/
// * 4d28077b-566d-4132-b073-f4edaf61dcb9
// */
// @GET
// @Path(AccessPath.FACET_PATH_PART + "/" + AccessPath.INSTANCE_PATH_PART
// + "/{" + ID_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getFacet(@PathParam(ID_PATH_PARAM) String facetId)
// throws FacetNotFoundException, ResourceRegistryException {
// logger.info("Requested Facet with id {}", facetId);
// FacetManagement facetManagement = new FacetManagement();
// facetManagement.setUUID(UUID.fromString(facetId));
// return facetManagement.read();
// }
//
// /*
// * e.g. GET /resource-registry/access/facet/schema/ContactFacet?
// * includeSubtypes=true&
// * includeSchema=true
// *
// */
// @GET
// @Path(AccessPath.FACET_PATH_PART + "/" + AccessPath.SCHEMA_PATH_PART + "/{"
// + TYPE_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getFacetSchema(@PathParam(TYPE_PATH_PARAM) String facetType,
// @QueryParam(AccessPath.INCLUDE_SUBTYPES_PARAM) Boolean includeSubtypes,
// @QueryParam(AccessPath.INCLUDE_SCHEMA_PARAM) Boolean includeSchema)
// throws SchemaNotFoundException, SchemaException {
// logger.info("Requested Facet Schema for type {}", facetType);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.readFacetSchema(facetType, includeSubtypes,
// includeSchema);
// }
//
// /*
// * e.g. GET /resource-registry/access/resource/instance/
// * cc132a2c-d0b0-45a8-92fa-7451f6a44b6d
// */
// @GET
// @Path(AccessPath.RESOURCE_PATH_PART + "/" + AccessPath.INSTANCE_PATH_PART
// + "/{" + ID_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getResource(@PathParam(ID_PATH_PARAM) String resourceId)
// throws ResourceNotFoundException, ResourceRegistryException {
// logger.info("Requested Resource with id {}", resourceId);
// ResourceManagement resourceManagement = new ResourceManagement();
// resourceManagement.setUUID(UUID.fromString(resourceId));
// return resourceManagement.read();
// }
//
//
//
//
// /*
// * e.g. GET /resource-registry/access/resource/schema/HostingNode?
// * includeSubtypes=true&
// * includeSchema=true
// */
// @GET
// @Path(AccessPath.RESOURCE_PATH_PART + "/" + AccessPath.SCHEMA_PATH_PART
// + "/{" + TYPE_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getResourceSchema(
// @PathParam(TYPE_PATH_PARAM) String resourceType,
// @QueryParam(AccessPath.INCLUDE_SUBTYPES_PARAM) Boolean includeSubtypes,
// @QueryParam(AccessPath.INCLUDE_SCHEMA_PARAM) Boolean includeSchema)
// throws SchemaNotFoundException, SchemaException {
// logger.info("Requested Resource Schema for type {}", resourceType);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.getResourceSchema(resourceType,
// includeSubtypes, includeSchema);
// }
//
// /*
// * e.g. GET /resource-registry/access/embedded/schema/Embedded?
// * includeSubtypes=true&
// * includeSchema=true
// */
// @GET
// @Path(AccessPath.EMBEDDED_PATH_PART + "/" + AccessPath.SCHEMA_PATH_PART
// + "/{" + TYPE_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getEmbeddedSchema(
// @PathParam(TYPE_PATH_PARAM) String embeddedType,
// @QueryParam(AccessPath.INCLUDE_SUBTYPES_PARAM) Boolean includeSubtypes,
// @QueryParam(AccessPath.INCLUDE_SCHEMA_PARAM) Boolean includeSchema)
// throws SchemaNotFoundException, SchemaException {
// if (includeSchema == null) {
// includeSchema = false;
// }
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.getEmbeddedTypeSchema(embeddedType,
// includeSubtypes, includeSchema);
// }
//
// /*
// * e.g. GET /resource-registry/access/consistsOf/schema/HasContact?
// * includeSubtypes=true&
// * includeSchema=true
// */
// @GET
// @Path(AccessPath.CONSISTS_OF_PATH_PART + "/" + AccessPath.SCHEMA_PATH_PART
// + "/{" + TYPE_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getConsistsOfSchema(
// @PathParam(TYPE_PATH_PARAM) String consistsOfType,
// @QueryParam(AccessPath.INCLUDE_SUBTYPES_PARAM) Boolean includeSubtypes,
// @QueryParam(AccessPath.INCLUDE_SCHEMA_PARAM) Boolean includeSchema)
// throws SchemaNotFoundException, SchemaException {
// if (includeSchema == null) {
// includeSchema = false;
// }
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.getConsistsOfSchema(consistsOfType,
// includeSubtypes, includeSchema);
// }
//
// /*
// * e.g. GET /resource-registry/access/isRelatedTo/schema/HasContact?
// * includeSubtypes=true&
// * includeSchema=true
// */
// @GET
// @Path(AccessPath.IS_RELATED_TO_PATH_PART + "/"
// + AccessPath.SCHEMA_PATH_PART + "/{" + TYPE_PATH_PARAM + "}")
// @Produces(MediaType.APPLICATION_JSON)
// public String getIsRelatedToSchema(
// @PathParam(TYPE_PATH_PARAM) String isRelatedToType,
// @QueryParam(AccessPath.INCLUDE_SUBTYPES_PARAM) Boolean includeSubtypes,
// @QueryParam(AccessPath.INCLUDE_SCHEMA_PARAM) Boolean includeSchema)
// throws SchemaNotFoundException, SchemaException {
// if (includeSchema == null) {
// includeSchema = false;
// }
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.getIsRelatedToSchema(isRelatedToType,
// includeSubtypes, includeSchema);
// }
}

View File

@ -3,10 +3,13 @@
*/
package org.gcube.informationsystem.resourceregistry.rest;
import org.gcube.informationsystem.model.embedded.Embedded;
import org.gcube.informationsystem.model.entity.Context;
import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsParentOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.model.relation.Relation;
@ -17,18 +20,25 @@ import org.gcube.informationsystem.model.relation.Relation;
*/
public enum AccessType {
ENTITY(Entity.NAME),
RESOURCE(Resource.NAME),
FACET(Facet.NAME),
EMBEDDED(Embedded.class, Embedded.NAME),
CONTEXT(Context.class, Context.NAME),
IS_PARENT_OF(IsParentOf.class, IsParentOf.NAME),
RELATION(Relation.NAME),
IS_RELATED_TO(IsRelatedTo.NAME),
CONSISTS_OF(ConsistsOf.NAME);
ENTITY(Entity.class, Entity.NAME),
RESOURCE(Resource.class, Resource.NAME),
FACET(Facet.class, Facet.NAME),
RELATION(Relation.class, Relation.NAME),
IS_RELATED_TO(IsRelatedTo.class, IsRelatedTo.NAME),
CONSISTS_OF(ConsistsOf.class, ConsistsOf.NAME);
private final Class<?> clz;
private final String name;
private final String lowerCaseFirstCharacter;
AccessType(String name){
AccessType(Class<?> clz, String name){
this.clz = clz;
this.name = name;
this.lowerCaseFirstCharacter = name.substring(0, 1).toLowerCase() + name.substring(1);
}
@ -37,6 +47,14 @@ public enum AccessType {
return lowerCaseFirstCharacter;
}
public Class<?> getTypeClass(){
return clz;
}
public String getName(){
return name;
}
@Override
public String toString(){
return name;

View File

@ -4,14 +4,11 @@ import javax.ws.rs.ApplicationPath;
import javax.ws.rs.Consumes;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.gcube.informationsystem.model.embedded.Embedded;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.rest.SchemaPath;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement;
@ -23,116 +20,171 @@ import org.slf4j.LoggerFactory;
* @author Luca Frosini (ISTI - CNR)
* @author Lucio Lelii (ISTI - CNR)
*/
/**
* @author Luca Frosini (ISTI - CNR)
*
*/
@ApplicationPath(SchemaPath.SCHEMA_PATH_PART)
public class SchemaManager {
private static Logger logger = LoggerFactory.getLogger(SchemaManager.class);
public static final String TYPE_PATH_PARAM = "type";
/**
* e.g. PUT /resource-registry/schema/embedded
* e.g. PUT /resource-registry/schema/{E-R}
*
* BODY: {...}
*
* ?schema={...}
*
* @param jsonSchema
* @param type
* @param json
* @return
* @throws SchemaException
*/
@PUT
@Path(SchemaPath.EMBEDDED_PATH_PART)
@Path("{" + TYPE_PATH_PARAM + "}")
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
public String registerEmbeddedTypeSchema(String jsonSchema)
throws SchemaException {
logger.trace("Requested {} registration with schema {}", Embedded.NAME,
jsonSchema);
public String create(
@PathParam(TYPE_PATH_PARAM) String type,
String json)
throws SchemaException, ResourceRegistryException {
logger.trace("Requested {} registration with schema {}", type, json);
AccessType accessType = null;
try {
accessType = AccessType.valueOf(type);
switch (accessType) {
case EMBEDDED:
break;
case FACET:
break;
case RESOURCE:
break;
case IS_RELATED_TO:
break;
case CONSISTS_OF:
break;
default:
throw new Exception();
}
} catch (Exception e) {
String error = String.format("Cannot register %s schema", type);
throw new ResourceRegistryException(error);
}
SchemaManagement schemaManagement = new SchemaManagementImpl();
return schemaManagement.registerEmbeddedTypeSchema(jsonSchema);
return schemaManagement.create(json, accessType);
}
/**
* e.g. PUT /resource-registry/schema/facet
*
* BODY: {...}
*
* @param jsonSchema
* @return
* @throws SchemaException
*/
@PUT
@Path(SchemaPath.FACET_PATH_PART)
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
public String registerFacetSchema(String jsonSchema) throws SchemaException {
logger.trace("Requested {} registration with schema {}", Facet.NAME,
jsonSchema);
SchemaManagement schemaManagement = new SchemaManagementImpl();
return schemaManagement.createFacetSchema(jsonSchema);
}
/**
* e.g. PUT /resource-registry/schema/resource
*
* BODY: {...}
*
* @param jsonSchema
* @param jsonSchema
* @return
* @throws SchemaException
*/
@PUT
@Path(SchemaPath.RESOURCE_PATH_PART)
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
public String registerResourceSchema(String jsonSchema)
throws SchemaException {
logger.trace("Requested {} registration with schema {}", Resource.NAME,
jsonSchema);
SchemaManagement schemaManagement = new SchemaManagementImpl();
return schemaManagement.registerResourceSchema(jsonSchema);
}
/**
* e.g. PUT /resource-registry/schema/consistsOf
*
* BODY: {...}
*
* @param jsonSchema
* @return
* @throws SchemaException
*/
@PUT
@Path(SchemaPath.CONSISTS_OF_PATH_PART)
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
public String registerConsistOfSchema(String jsonSchema)
throws SchemaException {
logger.trace("Requested {} registration with schema {} ",
ConsistsOf.NAME, jsonSchema);
SchemaManagement schemaManagement = new SchemaManagementImpl();
return schemaManagement.registerConsistsOfSchema(jsonSchema);
}
/**
* e.g. PUT /resource-registry/schema/isRelatedTo
*
* BODY: {...}
*
* @param jsonSchema
* @return
* @throws SchemaException
*/
@PUT
@Path(SchemaPath.IS_RELATED_TO_PATH_PART)
@Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
public String registerIsRelatedToSchema(String jsonSchema)
throws SchemaException {
logger.trace("Requested {} registration with schema {} ",
IsRelatedTo.NAME, jsonSchema);
SchemaManagement schemaManagement = new SchemaManagementImpl();
return schemaManagement.registerIsRelatedToSchema(jsonSchema);
}
// /**
// * e.g. PUT /resource-registry/schema/embedded
// *
// * BODY: {...}
// *
// * @param json
// * @return
// * @throws SchemaException
// */
// @PUT
// @Path(SchemaPath.EMBEDDED_PATH_PART)
// @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
// @Produces(MediaType.APPLICATION_JSON)
// public String registerEmbeddedTypeSchema(String json)
// throws SchemaException {
// logger.trace("Requested {} registration with schema {}", Embedded.NAME,
// json);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.create(json, AccessType.EMBEDDED);
// }
//
// /**
// * e.g. PUT /resource-registry/schema/facet
// *
// * BODY: {...}
// *
// * @param json
// * @return
// * @throws SchemaException
// */
// @PUT
// @Path(SchemaPath.FACET_PATH_PART)
// @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
// @Produces(MediaType.APPLICATION_JSON)
// public String registerFacetSchema(String json) throws SchemaException {
// logger.trace("Requested {} registration with schema {}", Facet.NAME,
// json);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.create(json, AccessType.FACET);
// }
//
// /**
// * e.g. PUT /resource-registry/schema/resource
// *
// * BODY: {...}
// *
// * @param jsonSchema
// * @return
// * @throws SchemaException
// */
// @PUT
// @Path(SchemaPath.RESOURCE_PATH_PART)
// @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
// @Produces(MediaType.APPLICATION_JSON)
// public String registerResourceSchema(String json)
// throws SchemaException {
// logger.trace("Requested {} registration with schema {}", Resource.NAME,
// json);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.create(json, AccessType.RESOURCE);
// }
//
// /**
// * e.g. PUT /resource-registry/schema/consistsOf
// *
// * BODY: {...}
// *
// * @param jsonSchema
// * @return
// * @throws SchemaException
// */
// @PUT
// @Path(SchemaPath.CONSISTS_OF_PATH_PART)
// @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
// @Produces(MediaType.APPLICATION_JSON)
// public String registerConsistsOfSchema(String json)
// throws SchemaException {
// logger.trace("Requested {} registration with schema {} ",
// ConsistsOf.NAME, json);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.create(json, AccessType.CONSISTS_OF);
// }
//
// /**
// * e.g. PUT /resource-registry/schema/isRelatedTo
// *
// * BODY: {...}
// *
// * @param jsonSchema
// * @return
// * @throws SchemaException
// */
// @PUT
// @Path(SchemaPath.IS_RELATED_TO_PATH_PART)
// @Consumes({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
// @Produces(MediaType.APPLICATION_JSON)
// public String registerIsRelatedToSchema(String json)
// throws SchemaException {
// logger.trace("Requested {} registration with schema {} ",
// IsRelatedTo.NAME, json);
// SchemaManagement schemaManagement = new SchemaManagementImpl();
// return schemaManagement.create(json, AccessType.IS_RELATED_TO);
// }
}

View File

@ -2,6 +2,7 @@ package org.gcube.informationsystem.resourceregistry.schema;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.rest.AccessType;
/**
* @author Luca Frosini (ISTI - CNR)
@ -12,16 +13,15 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
*/
public interface SchemaManagement {
public String create(String json, AccessType accessType) throws SchemaException;
public String read(String type, AccessType accessType, boolean includeSubtypes) throws SchemaNotFoundException, SchemaException;
public String update(String type, AccessType accessType, String json) throws SchemaNotFoundException, SchemaException;
public String delete(String type, AccessType accessType) throws SchemaNotFoundException;
/*
public String create(String json) throws SchemaException;
public String read(String type, boolean includeSubtypes, boolean includeSchema) throws SchemaNotFoundException, SchemaException;
public String update(String type, String json) throws SchemaNotFoundException, SchemaException;
public String delete(String type) throws SchemaNotFoundException;
*/
public String createEntitySchema(String jsonSchema) throws SchemaException;
public String readEntitySchema(String entityType, boolean includeSubtypes, boolean includeSchema) throws SchemaNotFoundException, SchemaException;
@ -83,5 +83,6 @@ public interface SchemaManagement {
public String updateIsRelatedToSchema(String isRelatedToType, String jsonSchema) throws SchemaNotFoundException, SchemaException;
public String deleteIsRelatedToSchema(String isRelatedToType) throws SchemaException;
*/
}

View File

@ -8,20 +8,15 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.gcube.informationsystem.model.embedded.Embedded;
import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.Facet;
import org.gcube.informationsystem.model.entity.Resource;
import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.model.relation.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper;
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
import org.gcube.informationsystem.resourceregistry.rest.AccessType;
import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.TypeBinder.Property;
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
@ -29,7 +24,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.metadata.OMetadata;
import com.orientechnologies.orient.core.metadata.schema.OClass;
import com.orientechnologies.orient.core.metadata.schema.OClassImpl;
@ -55,11 +49,8 @@ public class SchemaManagementImpl implements SchemaManagement {
private static Logger logger = LoggerFactory
.getLogger(SchemaManagementImpl.class);
protected static OClass getEntityOClass(OrientBaseGraph orientBaseGraph,
String entityType) throws SchemaException {
OMetadata oMetadata = orientBaseGraph.getRawGraph().getMetadata();
OSchema oSchema = oMetadata.getSchema();
return oSchema.getClass(entityType);
protected static OClass getOClass(OSchema oSchema, String type) throws SchemaException {
return oSchema.getClass(type);
}
public static OClass getTypeSchema(OrientBaseGraph orientBaseGraph,
@ -114,7 +105,8 @@ public class SchemaManagementImpl implements SchemaManagement {
protected static TypeDefinition getTypeDefinition(OClass oClass)
throws SchemaException {
String json = serializeOClass(oClass);
ODocument oDocument = ((OClassImpl) oClass).toStream();
String json = oDocument.toJSON();
try {
return TypeBinder.deserializeTypeDefinition(json);
} catch (Exception e) {
@ -127,32 +119,17 @@ public class SchemaManagementImpl implements SchemaManagement {
try {
TypeDefinition typeDefinition = getTypeDefinition(oClass);
return TypeBinder.serializeType(typeDefinition);
return TypeBinder.serializeTypeDefinition(typeDefinition);
} catch (Exception e) {
throw new SchemaException(e);
}
}
protected static JSONObject serializeOClassAsJSON(OClass oClass)
throws SchemaException {
String json = serializeOClass(oClass);
try {
return new JSONObject(json);
} catch (JSONException e) {
throw new SchemaException(e);
}
}
protected static String serializeOClass(OClass oClass) {
ODocument oDocument = ((OClassImpl) oClass).toStream();
return oDocument.toJSON();
}
protected List<OClass> getSuperclassesAndCheckCompliancy(
OrientGraphNoTx orientGraphNoTx, TypeDefinition typeDefinition,
String baseType) throws SchemaException {
Set<String> superClasses = typeDefinition.getSuperclasses();
Set<String> superClasses = typeDefinition.getSuperClasses();
if (baseType != null) {
if (superClasses == null || superClasses.size() == 0) {
throw new RuntimeException(
@ -162,9 +139,12 @@ public class SchemaManagementImpl implements SchemaManagement {
}
}
OMetadata oMetadata = orientGraphNoTx.getRawGraph().getMetadata();
OSchema oSchema = oMetadata.getSchema();
List<OClass> oSuperclasses = new ArrayList<>();
for (String superClass : superClasses) {
OClass oSuperClass = getEntityOClass(orientGraphNoTx, superClass);
OClass oSuperClass = getOClass(oSchema, superClass);
if (baseType != null) {
if (typeDefinition.getName().compareTo(baseType) != 0) {
if (!oSuperClass.isSubClassOf(baseType)) {
@ -181,17 +161,7 @@ public class SchemaManagementImpl implements SchemaManagement {
return oSuperclasses;
}
protected String getTypeSchemaAsString(String type, String baseType)
throws SchemaNotFoundException {
try {
OClass oClass = getTypeSchema(type, baseType);
return serializeOClass(oClass);
} catch (Exception e) {
throw new SchemaNotFoundException(e);
}
}
protected String registerTypeSchema(String jsonSchema, Class<?> baseType)
protected String registerTypeSchema(String jsonSchema, AccessType baseType)
throws SchemaException {
OrientGraphFactory orientGraphFactory = SecurityContextMapper
@ -201,7 +171,7 @@ public class SchemaManagementImpl implements SchemaManagement {
OrientGraphNoTx orientGraphNoTx = null;
try {
logger.info("Trying to register {} {}", baseType.getSimpleName(),
logger.info("Trying to register {} {}", baseType.getName(),
jsonSchema);
ObjectMapper mapper = new ObjectMapper();
@ -209,26 +179,26 @@ public class SchemaManagementImpl implements SchemaManagement {
TypeDefinition.class);
orientGraphNoTx = orientGraphFactory.getNoTx();
OMetadata oMetadata = orientGraphNoTx.getRawGraph().getMetadata();
OSchema oSchema = oMetadata.getSchema();
OClass oClass = null;
if (Entity.class.isAssignableFrom(baseType)) {
if (Entity.class.isAssignableFrom(baseType.getTypeClass())) {
oClass = orientGraphNoTx.createVertexType(typeDefinition
.getName());
} else if (Relation.class.isAssignableFrom(baseType)) {
} else if (Relation.class.isAssignableFrom(baseType.getTypeClass())) {
oClass = orientGraphNoTx.createEdgeType(typeDefinition
.getName());
} else if (Embedded.class.isAssignableFrom(baseType)) {
ODatabaseDocumentTx oDatabaseDocumentTx = orientGraphNoTx
.getRawGraph();
OMetadata oMetadata = oDatabaseDocumentTx.getMetadata();
OSchema oSchema = oMetadata.getSchema();
} else if (Embedded.class.isAssignableFrom(baseType.getTypeClass())) {
oClass = oSchema.createClass(typeDefinition.getName());
}
oClass.setDescription(typeDefinition.getDescription());
try {
oClass.setAbstract(typeDefinition.isAbstractType());
oClass.setAbstract(typeDefinition.isAbstract());
} catch (Exception e) {
logger.error(
"Unable to set the Vertex Type {} as abstract. This is an OrientDB <= 2.2.12 bug. The Type will be created as it is not abstarct.",
@ -238,11 +208,11 @@ public class SchemaManagementImpl implements SchemaManagement {
if (typeDefinition.getName().compareTo(Embedded.NAME) != 0) {
List<OClass> oSuperclasses = getSuperclassesAndCheckCompliancy(
orientGraphNoTx, typeDefinition,
baseType.getSimpleName());
baseType.getName());
oClass.setSuperClasses(oSuperclasses);
}
if (Resource.class.isAssignableFrom(baseType)) {
if (Resource.class.isAssignableFrom(baseType.getTypeClass())) {
Set<Property> properties = typeDefinition.getProperties();
if (properties != null && properties.size() > 0) {
throw new Exception(
@ -264,9 +234,9 @@ public class SchemaManagementImpl implements SchemaManagement {
op.setNotNull(false);
op.setReadonly(property.isReadonly());
op.setRegexp(property.getRegexpr());
op.setRegexp(property.getRegexp());
if (property.getLinkedClass() != null) {
OClass linkedClass = getEntityOClass(orientGraphNoTx,
OClass linkedClass = getOClass(oSchema,
property.getLinkedClass());
if (linkedClass == null) {
logger.trace("class {} not found in schema",
@ -292,13 +262,12 @@ public class SchemaManagementImpl implements SchemaManagement {
OClass toBeSerializedOClass = oClass;
if (oClass instanceof OrientElementType) {
toBeSerializedOClass = getEntityOClass(orientGraphNoTx,
typeDefinition.getName());
toBeSerializedOClass = getOClass(oSchema, typeDefinition.getName());
}
String ret = serializeOClass(toBeSerializedOClass);
String ret = getTypeDefinitionAsString(toBeSerializedOClass);
logger.info("{} type registered successfully: {}",
baseType.getSimpleName(), jsonSchema);
baseType.getName(), jsonSchema);
return ret;
} catch (Exception e) {
@ -310,8 +279,8 @@ public class SchemaManagementImpl implements SchemaManagement {
}
}
protected String getSchema(String type, String baseType,
boolean includeSubtypes, boolean includeSchema)
protected String getSchema(String type, AccessType baseType,
boolean includeSubtypes)
throws SchemaNotFoundException, SchemaException {
OrientGraphFactory orientGraphFactory = SecurityContextMapper
.getSecurityContextFactory(
@ -324,31 +293,18 @@ public class SchemaManagementImpl implements SchemaManagement {
OMetadata oMetadata = orientGraphNoTx.getRawGraph().getMetadata();
OSchema oSchema = oMetadata.getSchema();
OClass baseOClass = getTypeSchema(oSchema, type, baseType);
OClass baseOClass = getTypeSchema(oSchema, type, baseType.getName());
String ret = null;
if (includeSubtypes) {
JSONArray jsonArray = new JSONArray();
Collection<OClass> oClasses = oSchema.getClasses();
for (OClass oClass : oClasses) {
if (oClass.isSubClassOf(baseOClass)) {
if (includeSchema) {
jsonArray.put(getTypeDefinitionAsString(oClass));
} else {
jsonArray.put(oClass.getName());
}
}
}
ret = jsonArray.toString();
} else {
if (includeSchema) {
ret = getTypeDefinitionAsString(baseOClass);
} else {
ret = baseOClass.getName();
List<TypeDefinition> typeDefinitions = new ArrayList<>();
Collection<OClass> oClasses = oSchema.getClasses();
for (OClass oClass : oClasses) {
if (oClass.isSubClassOf(baseOClass)) {
typeDefinitions.add(getTypeDefinition(oClass));
}
}
return ret;
return TypeBinder.serializeTypeDefinitions(typeDefinitions);
} catch (SchemaException e) {
throw e;
} catch (Exception e) {
@ -362,182 +318,26 @@ public class SchemaManagementImpl implements SchemaManagement {
}
@Override
public String createEntitySchema(String jsonSchema) throws SchemaException {
return registerTypeSchema(jsonSchema, Entity.class);
public String create(String jsonSchema, AccessType accessType) throws SchemaException {
return registerTypeSchema(jsonSchema, accessType);
}
@Override
public String readEntitySchema(String entityType, boolean includeSubtypes,
boolean includeSchema) throws SchemaNotFoundException,
public String read(String entityType, AccessType accessType, boolean includeSubtypes) throws SchemaNotFoundException,
SchemaException {
return getSchema(entityType, Entity.NAME, includeSubtypes,
includeSchema);
return getSchema(entityType, accessType, includeSubtypes);
}
@Override
public String updateEntitySchema(String entityType, String jsonSchema)
public String update(String entityType, AccessType accessType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteEntitySchema(String entityType)
public String delete(String entityType, AccessType accessType)
throws SchemaNotFoundException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String createFacetSchema(String jsonSchema) throws SchemaException {
return registerTypeSchema(jsonSchema, Facet.class);
}
@Override
public String readFacetSchema(String facetType, boolean includeSubtypes,
boolean includeSchema) throws SchemaNotFoundException,
SchemaException {
return getSchema(facetType, Facet.NAME, includeSubtypes, includeSchema);
}
@Override
public String updateFacetSchema(String facetType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteFacetSchema(String facetType)
throws SchemaNotFoundException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String registerResourceSchema(String jsonSchema)
throws SchemaException {
return registerTypeSchema(jsonSchema, Resource.class);
}
@Override
public String getResourceSchema(String resourceType,
boolean includeSubtypes, boolean includeSchema)
throws SchemaNotFoundException, SchemaException {
return getSchema(resourceType, Resource.NAME, includeSubtypes,
includeSchema);
}
@Override
public String updateResourceSchema(String resourceType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteResourceSchema(String resourceType)
throws SchemaNotFoundException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String registerEmbeddedTypeSchema(String jsonSchema)
throws SchemaException {
return registerTypeSchema(jsonSchema, Embedded.class);
}
@Override
public String getEmbeddedTypeSchema(String embeddedType,
boolean includeSubtypes, boolean includeSchema)
throws SchemaNotFoundException, SchemaException {
return getSchema(embeddedType, Embedded.NAME, includeSubtypes,
includeSchema);
}
@Override
public String updateEmbeddedTypeSchema(String embeddedType,
String jsonSchema) throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteEmbeddedTypeSchema(String embeddedType)
throws SchemaNotFoundException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String registerRelationSchema(String jsonSchema)
throws SchemaException {
return registerTypeSchema(jsonSchema, Relation.class);
}
@Override
public String getRelationSchema(String relationType,
boolean includeSubtypes, boolean includeSchema)
throws SchemaNotFoundException, SchemaException {
return getSchema(relationType, Relation.NAME, includeSubtypes,
includeSchema);
}
@Override
public String updateRelationSchema(String relationType, String jsonSchema)
throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteRelationSchema(String relationType)
throws SchemaNotFoundException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String registerConsistsOfSchema(String jsonSchema)
throws SchemaException {
return registerTypeSchema(jsonSchema, ConsistsOf.class);
}
@Override
public String getConsistsOfSchema(String consistsOfType,
boolean includeSubtypes, boolean includeSchema)
throws SchemaNotFoundException, SchemaException {
return getSchema(consistsOfType, ConsistsOf.NAME, includeSubtypes,
includeSchema);
}
@Override
public String updateConsistsOfSchema(String consistsOfType,
String jsonSchema) throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteConsistsOfSchema(String consistsOfType)
throws SchemaNotFoundException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String registerIsRelatedToSchema(String jsonSchema)
throws SchemaException {
return registerTypeSchema(jsonSchema, IsRelatedTo.class);
}
@Override
public String getIsRelatedToSchema(String isRelatedToType,
boolean includeSubtypes, boolean includeSchema)
throws SchemaNotFoundException, SchemaException {
return getSchema(isRelatedToType, IsRelatedTo.NAME, includeSubtypes,
includeSchema);
}
@Override
public String updateIsRelatedToSchema(String isRelatedToType,
String jsonSchema) throws SchemaNotFoundException, SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
@Override
public String deleteIsRelatedToSchema(String isRelatedToType)
throws SchemaException {
throw new UnsupportedOperationException("Not Yet implemented");
}
}

View File

@ -17,8 +17,7 @@ import org.gcube.informationsystem.model.relation.ConsistsOf;
import org.gcube.informationsystem.model.relation.IsRelatedTo;
import org.gcube.informationsystem.model.relation.Relation;
import org.gcube.informationsystem.model.relation.isrelatedto.Hosts;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement;
import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl;
import org.gcube.informationsystem.resourceregistry.rest.AccessType;
import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
import org.junit.Test;
@ -33,107 +32,111 @@ import com.fasterxml.jackson.databind.ObjectMapper;
*/
public class SchemaManagementImplTest {
private static Logger logger = LoggerFactory.getLogger(SchemaManagementImplTest.class);
private static Logger logger = LoggerFactory
.getLogger(SchemaManagementImplTest.class);
@Test
public void registerEmbeddedTypeSchema() throws Exception{
public void registerEmbeddedTypeSchema() throws Exception {
Class<?> clz = Header.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
//new SchemaManagementImpl().registerEmbeddedTypeSchema(json);
logger.debug(json);
//new SchemaManagementImpl().create(json, AccessType.EMBEDDED);
}
@Test
public void getEmbeddedTypeSchema() throws Exception{
String json = new SchemaManagementImpl().getEmbeddedTypeSchema(AccessPolicy.NAME, false, true);
logger.trace(json);
public void getEmbeddedTypeSchema() throws Exception {
String json = new SchemaManagementImpl().read(Embedded.NAME,
AccessType.EMBEDDED, false);
logger.debug(json);
}
@Test
public void registerFacetSchema() throws Exception{
public void registerFacetSchema() throws Exception {
Class<?> clz = ContactFacet.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
//new SchemaManagementImpl().registerFacetSchema(json);
TypeBinder.deserializeTypeDefinition(json);
}
@Test
public void getFacetSchema() throws Exception{
String json = new SchemaManagementImpl().readFacetSchema(ContactFacet.NAME, false, true);
public void getFacetSchema() throws Exception {
String json = new SchemaManagementImpl().read(ContactFacet.NAME,
AccessType.FACET, false);
logger.info(json);
TypeDefinition typeDefinition = TypeBinder.deserializeTypeDefinition(json);
logger.info(typeDefinition.toString());
List<TypeDefinition> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json);
logger.info("{}", typeDefinitions);
}
@Test
public void registerEntityTypeSchema() throws Exception{
public void registerEntityTypeSchema() throws Exception {
Class<?> clz = Entity.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
//new SchemaManagementImpl().registerEntitySchema(json);
// new SchemaManagementImpl().registerEntitySchema(json);
}
@Test
public void registerResourceSchema() throws Exception{
Class<?> clz = Actor.class;
public void registerResourceSchema() throws Exception {
Class<?> clz = Resource.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
//new SchemaManagementImpl().registerFacetSchema(json);
logger.info(json);
// new SchemaManagementImpl().registerFacetSchema(json);
}
@Test
public void getResourceSchema() throws Exception{
String json = new SchemaManagementImpl().getResourceSchema(Actor.NAME, false, true);
public void getResourceSchema() throws Exception {
String json = new SchemaManagementImpl().read(Actor.NAME,
AccessType.RESOURCE, false);
logger.trace(json);
}
@Test
public void registerRelation() throws Exception{
public void registerRelation() throws Exception {
Class<?> clz = Hosts.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
//new SchemaManagementImpl().registerFacetSchema(json);
// new SchemaManagementImpl().registerFacetSchema(json);
}
@Test
public void getList() throws Exception{
public void getList() throws Exception {
logger.debug("\n\n\n");
boolean includeSubTypes = true;
boolean includeSchema = true;
SchemaManagement schemaManagement = new SchemaManagementImpl();
String list = schemaManagement.getEmbeddedTypeSchema(Embedded.NAME, includeSubTypes, includeSchema);
String list = schemaManagement.read(Embedded.NAME, AccessType.EMBEDDED,
includeSubTypes);
logger.debug("{} list : {}", Embedded.NAME, list);
ObjectMapper mapper = new ObjectMapper();
List<TypeDefinition> typeDefinitions = mapper.readValue(list, new TypeReference<List<TypeDefinition>>(){});
List<TypeDefinition> typeDefinitions = mapper.readValue(list,
new TypeReference<List<TypeDefinition>>() {
});
logger.debug("{}", typeDefinitions);
list = schemaManagement.readEntitySchema(Entity.NAME, includeSubTypes, includeSchema);
list = schemaManagement.read(Entity.NAME, AccessType.ENTITY,
includeSubTypes);
logger.debug("{} list : {}", Entity.NAME, list);
list = schemaManagement.getResourceSchema(Resource.NAME, includeSubTypes, includeSchema);
list = schemaManagement.read(Resource.NAME, AccessType.RESOURCE,
includeSubTypes);
logger.debug("{} list : {}", Resource.NAME, list);
list = schemaManagement.readFacetSchema(Facet.NAME, includeSubTypes, includeSchema);
list = schemaManagement.read(Facet.NAME, AccessType.FACET,
includeSubTypes);
logger.debug("{} list : {}", Facet.NAME, list);
list = schemaManagement.getRelationSchema(Relation.NAME, includeSubTypes, includeSchema);
list = schemaManagement.read(Relation.NAME, AccessType.RELATION,
includeSubTypes);
logger.debug("{} list : {}", Relation.NAME, list);
list = schemaManagement.getConsistsOfSchema(ConsistsOf.NAME, includeSubTypes, includeSchema);
list = schemaManagement.read(ConsistsOf.NAME, AccessType.CONSISTS_OF,
includeSubTypes);
logger.debug("{} list : {}", ConsistsOf.NAME, list);
list = schemaManagement.getIsRelatedToSchema(IsRelatedTo.NAME, includeSubTypes, includeSchema);
list = schemaManagement.read(IsRelatedTo.NAME,
AccessType.IS_RELATED_TO, includeSubTypes);
logger.debug("{} list : {}", IsRelatedTo.NAME, list);
}

View File

@ -11,9 +11,6 @@
<logger name="org.gcube" level="INFO" />
<logger name="org.gcube.informationsystem" level="DEBUG" />
<logger name="org.gcube.informationsystem.resourceregistry" level="DEBUG" />
<logger name="org.gcube.informationsystem.resourceregistry.context" level="DEBUG" />
<logger name="org.gcube.informationsystem.impl.utils.discovery" level="ERROR" />
<root level="WARN">
<appender-ref ref="STDOUT" />