diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java index 368d9eb..299a05c 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextManagement.java @@ -3,10 +3,10 @@ package org.gcube.informationsystem.resourceregistry.context; import java.util.Iterator; import java.util.UUID; -import org.gcube.informationsystem.model.reference.AccessType; -import org.gcube.informationsystem.model.reference.entities.Context; -import org.gcube.informationsystem.model.reference.properties.Header; -import org.gcube.informationsystem.model.reference.relations.IsParentOf; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.properties.Header; +import org.gcube.informationsystem.context.reference.entities.Context; +import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; @@ -128,7 +128,7 @@ public class ContextManagement extends EntityManagement { } else { // TODO Rewrite using Gremlin - String select = "SELECT FROM " + org.gcube.informationsystem.model.reference.entities.Context.NAME + " WHERE " + String select = "SELECT FROM " + Context.NAME + " WHERE " + Context.NAME_PROPERTY + " = \"" + getName() + "\"" + " AND in(\"" + IsParentOf.NAME + "\").size() = 0"; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextUtility.java index 5b8ae42..dcb105b 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/ContextUtility.java @@ -11,8 +11,8 @@ import org.gcube.common.authorization.library.AuthorizationEntry; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.impl.ScopeBean; -import org.gcube.informationsystem.model.reference.entities.Context; -import org.gcube.informationsystem.model.reference.relations.IsParentOf; +import org.gcube.informationsystem.context.reference.entities.Context; +import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/IsParentOfManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/IsParentOfManagement.java index a79f441..0268a54 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/context/IsParentOfManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/IsParentOfManagement.java @@ -2,12 +2,11 @@ package org.gcube.informationsystem.resourceregistry.context; import java.util.UUID; -import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; -import org.gcube.informationsystem.model.reference.relations.IsParentOf; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; @@ -32,16 +31,8 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraph; @SuppressWarnings("rawtypes") public class IsParentOfManagement extends RelationManagement { - public static final PropagationConstraint DEFAULT_IS_PARENT_OF_PC; - - static { - DEFAULT_IS_PARENT_OF_PC = new PropagationConstraintImpl(); - DEFAULT_IS_PARENT_OF_PC.setRemoveConstraint(RemoveConstraint.keep); - DEFAULT_IS_PARENT_OF_PC.setAddConstraint(AddConstraint.unpropagate); - } - public IsParentOfManagement() { - super(AccessType.IS_PARENT_OF, DEFAULT_IS_PARENT_OF_PC); + super(AccessType.IS_PARENT_OF, null); } public IsParentOfManagement(OrientGraph orientGraph) throws ResourceRegistryException { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/context/security/SecurityContext.java b/src/main/java/org/gcube/informationsystem/resourceregistry/context/security/SecurityContext.java index 4b5bb8d..0dbdadb 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/context/security/SecurityContext.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/context/security/SecurityContext.java @@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.gcube.informationsystem.model.reference.entities.Context; +import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java index 14eb551..3d725f3 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironment.java @@ -10,7 +10,7 @@ import java.util.Properties; import java.util.UUID; import org.gcube.common.encryption.SymmetricKey; -import org.gcube.informationsystem.model.reference.ISConstants; +import org.gcube.informationsystem.base.reference.ISConstants; import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java index c162c2f..1a2f36f 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/SchemaActionImpl.java @@ -1,6 +1,9 @@ package org.gcube.informationsystem.resourceregistry.dbinitialization; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; @@ -30,7 +33,7 @@ public class SchemaActionImpl implements SchemaAction { } @Override - public > void manageRelationClass(Class r) + public > void manageRelationClass(Class r) throws Exception { try { ((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(r)); @@ -43,7 +46,7 @@ public class SchemaActionImpl implements SchemaAction { } else { schemaManagement.create(json, AccessType.RELATION); } - } catch (SchemaAlreadyPresentException sape) { + } catch(SchemaAlreadyPresentException sape) { logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r)); } catch(Exception ex) { logger.error("Error creating schema for {} type {} : {}", Relation.NAME, r.getSimpleName(), @@ -53,7 +56,7 @@ public class SchemaActionImpl implements SchemaAction { } @Override - public void manageEntityClass(Class e) throws Exception { + public void manageEntityClass(Class e) throws Exception { try { ((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e)); String json = TypeBinder.serializeType(e); @@ -65,7 +68,7 @@ public class SchemaActionImpl implements SchemaAction { } else { schemaManagement.create(json, AccessType.ENTITY); } - } catch (SchemaAlreadyPresentException sape) { + } catch(SchemaAlreadyPresentException sape) { logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e)); } catch(Exception ex) { logger.error("Error creating schema for {} type {} : {}", Entity.NAME, e.getSimpleName(), ex.getMessage()); @@ -74,15 +77,15 @@ public class SchemaActionImpl implements SchemaAction { } @Override - public

void managePropertyClass(Class

e) throws Exception { + public

void managePropertyClass(Class

e) throws Exception { try { ((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e)); String json = TypeBinder.serializeType(e); logger.trace(json); schemaManagement.create(json, AccessType.PROPERTY); - } catch (SchemaAlreadyPresentException sape) { + } catch(SchemaAlreadyPresentException sape) { logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e)); - } catch(Exception ex) { + } catch(Exception ex) { logger.error("Error creating schema for {} type {} : {}", Property.NAME, e.getSimpleName(), ex.getMessage()); throw ex; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java index 23d739d..2f2e014 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java @@ -14,11 +14,11 @@ import java.util.UUID; import javax.activation.UnsupportedDataTypeException; -import org.gcube.informationsystem.model.reference.AccessType; -import org.gcube.informationsystem.model.reference.ER; -import org.gcube.informationsystem.model.reference.ISManageable; -import org.gcube.informationsystem.model.reference.entities.Context; -import org.gcube.informationsystem.model.reference.properties.Header; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.ER; +import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.properties.Header; +import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagementUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagementUtility.java index 1c4a88a..29180f9 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagementUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagementUtility.java @@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er; import java.util.UUID; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/PropertyManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/PropertyManagement.java index 9d26bb6..1429842 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/PropertyManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/PropertyManagement.java @@ -4,11 +4,11 @@ import java.security.Key; import java.util.HashSet; import java.util.Set; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.ISManageable; +import org.gcube.informationsystem.base.reference.properties.Header; import org.gcube.informationsystem.model.impl.properties.EncryptedImpl; -import org.gcube.informationsystem.model.reference.AccessType; -import org.gcube.informationsystem.model.reference.ISManageable; import org.gcube.informationsystem.model.reference.properties.Encrypted; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java index eb4a6de..6947a8f 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java @@ -6,11 +6,12 @@ import java.util.List; import java.util.Map; import java.util.UUID; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.entities.BaseEntity; +import org.gcube.informationsystem.base.reference.properties.Header; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; @@ -45,7 +46,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientVertexType; /** * @author Luca Frosini (ISTI - CNR) */ -public abstract class EntityManagement extends ERManagement { +public abstract class EntityManagement extends ERManagement { /** * Provide a cache edge-internal-id -> RelationManagement diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java index b959106..57a6648 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java @@ -1,6 +1,6 @@ package org.gcube.informationsystem.resourceregistry.er.entity; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java index 5825740..18fbda6 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java @@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er.entity; import java.util.Iterator; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java index 8a180e7..bd3f71b 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java @@ -1,7 +1,7 @@ package org.gcube.informationsystem.resourceregistry.er.relation; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; -import org.gcube.informationsystem.model.reference.AccessType; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java index b147061..790368a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java @@ -1,7 +1,7 @@ package org.gcube.informationsystem.resourceregistry.er.relation; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; -import org.gcube.informationsystem.model.reference.AccessType; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java index d846d06..2454983 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java @@ -6,7 +6,8 @@ import java.util.Iterator; import java.util.Map; import java.util.UUID; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; @@ -49,7 +50,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraph; * @author Luca Frosini (ISTI - CNR) */ @SuppressWarnings("rawtypes") -public abstract class RelationManagement +public abstract class RelationManagement extends ERManagement { protected final Class targetEntityClass; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index 2511b0b..91c2c4d 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -104,7 +104,7 @@ public class Access { @Path(AccessPath.CONTEXTS_PATH_PART) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) public String getAllContexts() throws ResourceRegistryException { - logger.info("Requested to read all {}s", org.gcube.informationsystem.model.reference.entities.Context.NAME); + logger.info("Requested to read all {}s", org.gcube.informationsystem.context.reference.entities.Context.NAME); setCalledMethodLocal(HTTPMETHOD.GET, AccessPath.CONTEXTS_PATH_PART); ContextManagement contextManagement = new ContextManagement(); return contextManagement.all(false); @@ -123,7 +123,7 @@ public class Access { if(uuid.compareTo(AccessPath.CURRENT_CONTEXT)==0){ uuid = ContextUtility.getCurrentSecurityContext().getUUID().toString(); } - logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.model.reference.entities.Context.NAME, uuid); + logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.context.reference.entities.Context.NAME, uuid); List pathValues = new ArrayList<>(); pathValues.add(AccessPath.CONTEXTS_PATH_PART); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java index faf2cc5..a17e216 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ContextManager.java @@ -16,7 +16,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; -import org.gcube.informationsystem.model.reference.entities.Context; +import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.resourceregistry.ResourceInitializer; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java index 54ba229..bba7097 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SchemaManager.java @@ -19,7 +19,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.resourceregistry.ResourceInitializer; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SharingManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SharingManagement.java index f365456..f04d1e4 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SharingManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/SharingManagement.java @@ -12,7 +12,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; -import org.gcube.informationsystem.model.reference.entities.Context; +import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaContextManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaContextManagement.java index d763f25..9f6a4ab 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaContextManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaContextManagement.java @@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.schema; import java.util.Iterator; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.relations.Relation; @@ -11,11 +11,12 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; -import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; +import org.gcube.informationsystem.types.TypeBinder; +import org.gcube.informationsystem.types.reference.TypeDefinition; +import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.databind.ObjectMapper; import com.orientechnologies.orient.core.record.impl.ODocument; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.orient.OrientEdge; @@ -61,18 +62,20 @@ public class SchemaContextManagement implements SchemaManagement { AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext(); orientGraph = adminSecurityContext.getGraph(PermissionMode.WRITER); - ObjectMapper mapper = new ObjectMapper(); - TypeDefinition typeDefinition = mapper.readValue(json, TypeDefinition.class); + @SuppressWarnings("rawtypes") + TypeDefinition typeDefinition = TypeBinder.deserializeTypeDefinition(json); if(Entity.class.isAssignableFrom(baseType.getTypeClass())) { OrientVertex orientVertex = orientGraph.addVertex("class:" + typeDefinition.getName()); orientVertex.setProperty(SCHEMA, json); orientVertex.save(); } else if(Relation.class.isAssignableFrom(baseType.getTypeClass())) { - String sourceClass = typeDefinition.getSourceType(); + @SuppressWarnings("rawtypes") + String sourceClass = ((RelationTypeDefinition) typeDefinition).getSourceType(); Vertex source = getVertex(orientGraph, sourceClass); - String targetClass = typeDefinition.getTargetType(); + @SuppressWarnings("rawtypes") + String targetClass = ((RelationTypeDefinition) typeDefinition).getTargetType(); Vertex target = getVertex(orientGraph, targetClass); OrientEdge orientEdge = orientGraph.addEdge(null, source, target, typeDefinition.getName()); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java index bae13ea..6014729 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagement.java @@ -1,6 +1,6 @@ package org.gcube.informationsystem.resourceregistry.schema; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java index 95f549b..7fc9a6a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java @@ -14,7 +14,8 @@ import java.util.concurrent.Future; import javax.activation.UnsupportedDataTypeException; -import org.gcube.informationsystem.model.reference.AccessType; +import org.gcube.informationsystem.base.reference.AccessType; +import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.properties.Property; @@ -28,12 +29,11 @@ import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.types.TypeBinder; -import org.gcube.informationsystem.types.TypeBinder.PropertyDefinition; -import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; +import org.gcube.informationsystem.types.reference.TypeDefinition; +import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.databind.ObjectMapper; import com.orientechnologies.orient.core.db.ODatabaseSession; import com.orientechnologies.orient.core.exception.OSchemaException; import com.orientechnologies.orient.core.metadata.OMetadata; @@ -127,7 +127,7 @@ public class SchemaManagementImpl implements SchemaManagement { } } - protected static TypeDefinition getTypeDefinition(OClass oClass) throws SchemaException { + protected static TypeDefinition getTypeDefinition(OClass oClass) throws SchemaException { ODocument oDocument = ((OClassImpl) oClass).toStream(); String json = oDocument.toJSON(); try { @@ -137,18 +137,18 @@ public class SchemaManagementImpl implements SchemaManagement { } } - protected static String getTypeDefinitionAsString(OClass oClass) throws SchemaException { + protected static String getTypeDefinitionAsString(OClass oClass) throws SchemaException { try { - TypeDefinition typeDefinition = getTypeDefinition(oClass); + TypeDefinition typeDefinition = getTypeDefinition(oClass); return TypeBinder.serializeTypeDefinition(typeDefinition); } catch(Exception e) { throw new SchemaException(e); } } - protected List getSuperclassesAndCheckCompliancy(ODatabaseSession oDatabaseSession, - TypeDefinition typeDefinition, String baseType) throws SchemaException { + protected List getSuperclassesAndCheckCompliancy(ODatabaseSession oDatabaseSession, + TypeDefinition typeDefinition, String baseType) throws SchemaException { Set superClasses = typeDefinition.getSuperClasses(); if(baseType != null) { @@ -188,8 +188,9 @@ public class SchemaManagementImpl implements SchemaManagement { try { logger.info("Trying to register {} {}", baseType.getName(), jsonSchema); - ObjectMapper mapper = new ObjectMapper(); - TypeDefinition typeDefinition = mapper.readValue(jsonSchema, TypeDefinition.class); + + @SuppressWarnings("rawtypes") + TypeDefinition typeDefinition = TypeBinder.deserializeTypeDefinition(jsonSchema); if(typeName.compareTo(typeDefinition.getName())!=0) { String error = String.format("Provided type name path argument %s does not match with the type name in the definition %S. Please be coherent.", typeName, typeDefinition.getName()); @@ -341,7 +342,7 @@ public class SchemaManagementImpl implements SchemaManagement { } } - protected String getSchema(String type, boolean includeSubtypes) throws SchemaNotFoundException, SchemaException { + protected String getSchema(String type, boolean includeSubtypes) throws SchemaNotFoundException, SchemaException { ODatabaseSession oDatabaseSession = null; try { AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext(); @@ -351,7 +352,7 @@ public class SchemaManagementImpl implements SchemaManagement { OSchema oSchema = oMetadata.getSchema(); OClass baseOClass = getTypeSchema(oSchema, type, null); - List typeDefinitions = new ArrayList<>(); + List> typeDefinitions = new ArrayList<>(); typeDefinitions.add(getTypeDefinition(baseOClass)); if(includeSubtypes) { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java index b593c37..b6fde72 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderOrient.java @@ -3,14 +3,14 @@ package org.gcube.informationsystem.resourceregistry.utils; import java.util.Date; import java.util.UUID; -import org.gcube.informationsystem.model.reference.properties.Header; +import org.gcube.informationsystem.base.reference.properties.Header; import com.orientechnologies.orient.core.record.impl.ODocument; /** * @author Luca Frosini (ISTI - CNR) */ -public class HeaderOrient extends ODocument implements org.gcube.informationsystem.model.reference.properties.Header { +public class HeaderOrient extends ODocument implements Header { public HeaderOrient() { super(Header.NAME); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java index 3902e7f..bbda969 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/HeaderUtility.java @@ -9,8 +9,8 @@ import java.util.UUID; import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.ClientInfo; import org.gcube.common.authorization.library.utils.Caller; -import org.gcube.informationsystem.model.reference.ER; -import org.gcube.informationsystem.model.reference.properties.Header; +import org.gcube.informationsystem.base.reference.ER; +import org.gcube.informationsystem.base.reference.properties.Header; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.utils.ISMapper; import org.slf4j.Logger; @@ -31,7 +31,7 @@ public class HeaderUtility { private static final Logger logger = LoggerFactory.getLogger(HeaderUtility.class); public static String getUser() { - String user = org.gcube.informationsystem.model.reference.properties.Header.UNKNOWN_USER; + String user = Header.UNKNOWN_USER; try { Caller caller = AuthorizationProvider.instance.get(); if(caller != null) { diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java index 90d6f00..9ddd1c6 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/utils/Utility.java @@ -3,9 +3,9 @@ package org.gcube.informationsystem.resourceregistry.utils; import java.util.Iterator; import java.util.UUID; +import org.gcube.informationsystem.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.properties.Header; import org.gcube.informationsystem.model.reference.entities.Entity; -import org.gcube.informationsystem.model.reference.properties.Header; -import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; @@ -117,7 +117,7 @@ public class Utility { return element; } - public static

P getPropertyDocument(Class

clz, Element element, String property) + public static

P getPropertyDocument(Class

clz, Element element, String property) throws ResourceRegistryException { try { ODocument oDocument = element.getProperty(property); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java index 313d398..87a6cc6 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java @@ -4,10 +4,10 @@ import java.io.IOException; import java.util.List; import java.util.UUID; -import org.gcube.informationsystem.model.impl.entities.ContextImpl; -import org.gcube.informationsystem.model.impl.properties.HeaderImpl; -import org.gcube.informationsystem.model.reference.entities.Context; -import org.gcube.informationsystem.model.reference.relations.IsParentOf; +import org.gcube.informationsystem.base.impl.properties.HeaderImpl; +import org.gcube.informationsystem.context.impl.entities.ContextImpl; +import org.gcube.informationsystem.context.reference.entities.Context; +import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironmentTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironmentTest.java index 2860ca1..ed6cba6 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironmentTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseEnvironmentTest.java @@ -1,6 +1,6 @@ package org.gcube.informationsystem.resourceregistry.dbinitialization; -import org.gcube.informationsystem.model.reference.ISConstants; +import org.gcube.informationsystem.base.reference.ISConstants; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/er/AbstractERManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/AbstractERManagementTest.java index 355437d..c8cafaf 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/er/AbstractERManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/AbstractERManagementTest.java @@ -1,6 +1,6 @@ package org.gcube.informationsystem.resourceregistry.er; -import org.gcube.informationsystem.model.reference.ER; +import org.gcube.informationsystem.base.reference.ER; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; public abstract class AbstractERManagementTest { diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java index 55a509d..79ad6e7 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java @@ -16,8 +16,8 @@ import java.util.Map; import java.util.UUID; import org.gcube.common.authorization.library.provider.AuthorizationProvider; +import org.gcube.informationsystem.base.impl.properties.HeaderImpl; import org.gcube.informationsystem.model.impl.properties.EncryptedImpl; -import org.gcube.informationsystem.model.impl.properties.HeaderImpl; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl; import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java index 1ea4ec9..32335cb 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java @@ -22,13 +22,13 @@ import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.gcube.informationsystem.model.impl.properties.HeaderImpl; +import org.gcube.informationsystem.base.impl.properties.HeaderImpl; +import org.gcube.informationsystem.base.reference.properties.Header; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl; import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; @@ -49,10 +49,10 @@ import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasVolatileM import org.gcube.resourcemanagement.model.reference.entities.facets.CPUFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.ContainerStateFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet; +import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit; import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.SimplePropertyFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet; -import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit; import org.gcube.resourcemanagement.model.reference.entities.resources.EService; import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode; import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory; @@ -379,9 +379,12 @@ public class SmartgearResourcesTest extends ScopedTest { OperatingSystemMXBean mxbean = ManagementFactory .getOperatingSystemMXBean(); + @SuppressWarnings("restriction") com.sun.management.OperatingSystemMXBean sunmxbean = (com.sun.management.OperatingSystemMXBean) mxbean; + @SuppressWarnings("restriction") long freeMemory = sunmxbean.getFreePhysicalMemorySize() / 1048576; // in // MB + @SuppressWarnings("restriction") long totalMemory = sunmxbean.getTotalPhysicalMemorySize() / 1048576; // in // MB diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagementTest.java index 808bcd4..b82a3fe 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagementTest.java @@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er.entity; import java.util.UUID; -import org.gcube.informationsystem.model.reference.ER; +import org.gcube.informationsystem.base.reference.ER; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java index e09b36e..2bad8d0 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java @@ -5,17 +5,18 @@ 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.base.reference.properties.BaseProperty; +import org.gcube.informationsystem.base.reference.properties.Header; import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Resource; -import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.types.TypeBinder; -import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; +import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet; import org.gcube.resourcemanagement.model.reference.entities.resources.Actor; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts; @@ -36,7 +37,7 @@ public class SchemaManagementImplTest { @Test public void registerPropertyTypeSchema() throws Exception { - Class clz = Header.class; + Class clz = Header.class; String json = TypeBinder.serializeType(clz); logger.debug(json); //new SchemaManagementImpl().create(json, AccessType.PROPERTY); @@ -59,7 +60,7 @@ public class SchemaManagementImplTest { public void getFacetSchema() throws Exception { String json = new SchemaManagementImpl().read(ContactFacet.NAME, false); logger.info(json); - List typeDefinitions = TypeBinder.deserializeTypeDefinitions(json); + List> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json); logger.info("{}", typeDefinitions); } @@ -101,12 +102,12 @@ public class SchemaManagementImplTest { boolean includeSubTypes = true; SchemaManagement schemaManagement = new SchemaManagementImpl(); - String list = schemaManagement.read(Property.NAME, includeSubTypes); - logger.debug("{} list : {}", Property.NAME, list); + String list = schemaManagement.read(BaseProperty.NAME, includeSubTypes); + logger.debug("{} list : {}", BaseProperty.NAME, list); ObjectMapper mapper = new ObjectMapper(); - List typeDefinitions = mapper.readValue(list, - new TypeReference>() { + List> typeDefinitions = mapper.readValue(list, + new TypeReference>>() { }); logger.debug("{}", typeDefinitions);