Fixing imports and code to be aligned with model reorganization

This commit is contained in:
Luca Frosini 2019-10-25 17:45:59 +02:00
parent 1d8af30bea
commit b599c27351
32 changed files with 105 additions and 101 deletions

View File

@ -3,10 +3,10 @@ package org.gcube.informationsystem.resourceregistry.context;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID; 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.Context; import org.gcube.informationsystem.base.reference.properties.Header;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
@ -128,7 +128,7 @@ public class ContextManagement extends EntityManagement<Context> {
} else { } else {
// TODO Rewrite using Gremlin // 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 + Context.NAME_PROPERTY + " = \"" + getName() + "\"" + " AND in(\"" + IsParentOf.NAME
+ "\").size() = 0"; + "\").size() = 0";

View File

@ -11,8 +11,8 @@ import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean; import org.gcube.common.scope.impl.ScopeBean;
import org.gcube.informationsystem.model.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; 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.ContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;

View File

@ -2,12 +2,11 @@ package org.gcube.informationsystem.resourceregistry.context;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.model.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;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; 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.model.reference.relations.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -32,16 +31,8 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraph;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public class IsParentOfManagement extends RelationManagement<IsParentOf,ContextManagement,ContextManagement> { public class IsParentOfManagement extends RelationManagement<IsParentOf,ContextManagement,ContextManagement> {
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() { public IsParentOfManagement() {
super(AccessType.IS_PARENT_OF, DEFAULT_IS_PARENT_OF_PC); super(AccessType.IS_PARENT_OF, null);
} }
public IsParentOfManagement(OrientGraph orientGraph) throws ResourceRegistryException { public IsParentOfManagement(OrientGraph orientGraph) throws ResourceRegistryException {

View File

@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.Future; 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.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;

View File

@ -10,7 +10,7 @@ import java.util.Properties;
import java.util.UUID; import java.util.UUID;
import org.gcube.common.encryption.SymmetricKey; 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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext;

View File

@ -1,6 +1,9 @@
package org.gcube.informationsystem.resourceregistry.dbinitialization; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
@ -30,7 +33,7 @@ public class SchemaActionImpl implements SchemaAction {
} }
@Override @Override
public <R extends Relation<? extends Entity,? extends Entity>> void manageRelationClass(Class<R> r) public <R extends BaseRelation<? extends BaseEntity,? extends BaseEntity>> void manageRelationClass(Class<R> r)
throws Exception { throws Exception {
try { try {
((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(r)); ((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(r));
@ -43,7 +46,7 @@ public class SchemaActionImpl implements SchemaAction {
} else { } else {
schemaManagement.create(json, AccessType.RELATION); schemaManagement.create(json, AccessType.RELATION);
} }
} catch (SchemaAlreadyPresentException sape) { } catch(SchemaAlreadyPresentException sape) {
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r)); logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r));
} catch(Exception ex) { } catch(Exception ex) {
logger.error("Error creating schema for {} type {} : {}", Relation.NAME, r.getSimpleName(), logger.error("Error creating schema for {} type {} : {}", Relation.NAME, r.getSimpleName(),
@ -53,7 +56,7 @@ public class SchemaActionImpl implements SchemaAction {
} }
@Override @Override
public <E extends Entity> void manageEntityClass(Class<E> e) throws Exception { public <E extends BaseEntity> void manageEntityClass(Class<E> e) throws Exception {
try { try {
((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e)); ((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e));
String json = TypeBinder.serializeType(e); String json = TypeBinder.serializeType(e);
@ -65,7 +68,7 @@ public class SchemaActionImpl implements SchemaAction {
} else { } else {
schemaManagement.create(json, AccessType.ENTITY); schemaManagement.create(json, AccessType.ENTITY);
} }
} catch (SchemaAlreadyPresentException sape) { } catch(SchemaAlreadyPresentException sape) {
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e)); logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e));
} catch(Exception ex) { } catch(Exception ex) {
logger.error("Error creating schema for {} type {} : {}", Entity.NAME, e.getSimpleName(), ex.getMessage()); logger.error("Error creating schema for {} type {} : {}", Entity.NAME, e.getSimpleName(), ex.getMessage());
@ -74,13 +77,13 @@ public class SchemaActionImpl implements SchemaAction {
} }
@Override @Override
public <P extends Property> void managePropertyClass(Class<P> e) throws Exception { public <P extends BaseProperty> void managePropertyClass(Class<P> e) throws Exception {
try { try {
((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e)); ((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e));
String json = TypeBinder.serializeType(e); String json = TypeBinder.serializeType(e);
logger.trace(json); logger.trace(json);
schemaManagement.create(json, AccessType.PROPERTY); schemaManagement.create(json, AccessType.PROPERTY);
} catch (SchemaAlreadyPresentException sape) { } catch(SchemaAlreadyPresentException sape) {
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e)); 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(), logger.error("Error creating schema for {} type {} : {}", Property.NAME, e.getSimpleName(),

View File

@ -14,11 +14,11 @@ import java.util.UUID;
import javax.activation.UnsupportedDataTypeException; import javax.activation.UnsupportedDataTypeException;
import org.gcube.informationsystem.model.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.model.reference.ER; import org.gcube.informationsystem.base.reference.ER;
import org.gcube.informationsystem.model.reference.ISManageable; import org.gcube.informationsystem.base.reference.ISManageable;
import org.gcube.informationsystem.model.reference.entities.Context; import org.gcube.informationsystem.base.reference.properties.Header;
import org.gcube.informationsystem.model.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.AlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;

View File

@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er;
import java.util.UUID; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;

View File

@ -4,11 +4,11 @@ import java.security.Key;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; 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.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.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;

View File

@ -6,11 +6,12 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; 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.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
@ -45,7 +46,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientVertexType;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public abstract class EntityManagement<E extends Entity> extends ERManagement<E,Vertex> { public abstract class EntityManagement<E extends BaseEntity> extends ERManagement<E,Vertex> {
/** /**
* Provide a cache edge-internal-id -> RelationManagement * Provide a cache edge-internal-id -> RelationManagement

View File

@ -1,6 +1,6 @@
package org.gcube.informationsystem.resourceregistry.er.entity; 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.model.reference.entities.Facet;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;

View File

@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er.entity;
import java.util.Iterator; 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.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;

View File

@ -1,7 +1,7 @@
package org.gcube.informationsystem.resourceregistry.er.relation; 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.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;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;

View File

@ -1,7 +1,7 @@
package org.gcube.informationsystem.resourceregistry.er.relation; 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.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;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;

View File

@ -6,7 +6,8 @@ import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.UUID; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
@ -49,7 +50,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraph;
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public abstract class RelationManagement<R extends Relation, S extends EntityManagement, T extends EntityManagement> public abstract class RelationManagement<R extends BaseRelation, S extends EntityManagement, T extends EntityManagement>
extends ERManagement<R,Edge> { extends ERManagement<R,Edge> {
protected final Class<? extends Entity> targetEntityClass; protected final Class<? extends Entity> targetEntityClass;

View File

@ -104,7 +104,7 @@ public class Access {
@Path(AccessPath.CONTEXTS_PATH_PART) @Path(AccessPath.CONTEXTS_PATH_PART)
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8) @Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
public String getAllContexts() throws ResourceRegistryException { 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); setCalledMethodLocal(HTTPMETHOD.GET, AccessPath.CONTEXTS_PATH_PART);
ContextManagement contextManagement = new ContextManagement(); ContextManagement contextManagement = new ContextManagement();
return contextManagement.all(false); return contextManagement.all(false);
@ -123,7 +123,7 @@ public class Access {
if(uuid.compareTo(AccessPath.CURRENT_CONTEXT)==0){ if(uuid.compareTo(AccessPath.CURRENT_CONTEXT)==0){
uuid = ContextUtility.getCurrentSecurityContext().getUUID().toString(); 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<String> pathValues = new ArrayList<>(); List<String> pathValues = new ArrayList<>();
pathValues.add(AccessPath.CONTEXTS_PATH_PART); pathValues.add(AccessPath.CONTEXTS_PATH_PART);

View File

@ -16,7 +16,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.Response.Status;
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; 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.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;

View File

@ -19,7 +19,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.Response.Status;
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; 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.ResourceInitializer;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;

View File

@ -12,7 +12,7 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.Response.Status;
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD; 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.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;

View File

@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.schema;
import java.util.Iterator; 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.entities.Entity;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.model.reference.relations.Relation; 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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.orientechnologies.orient.core.record.impl.ODocument; import com.orientechnologies.orient.core.record.impl.ODocument;
import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge; import com.tinkerpop.blueprints.impls.orient.OrientEdge;
@ -61,18 +62,20 @@ public class SchemaContextManagement implements SchemaManagement {
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext(); AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
orientGraph = adminSecurityContext.getGraph(PermissionMode.WRITER); orientGraph = adminSecurityContext.getGraph(PermissionMode.WRITER);
ObjectMapper mapper = new ObjectMapper(); @SuppressWarnings("rawtypes")
TypeDefinition typeDefinition = mapper.readValue(json, TypeDefinition.class); TypeDefinition<? extends TypeDefinition> typeDefinition = TypeBinder.deserializeTypeDefinition(json);
if(Entity.class.isAssignableFrom(baseType.getTypeClass())) { if(Entity.class.isAssignableFrom(baseType.getTypeClass())) {
OrientVertex orientVertex = orientGraph.addVertex("class:" + typeDefinition.getName()); OrientVertex orientVertex = orientGraph.addVertex("class:" + typeDefinition.getName());
orientVertex.setProperty(SCHEMA, json); orientVertex.setProperty(SCHEMA, json);
orientVertex.save(); orientVertex.save();
} else if(Relation.class.isAssignableFrom(baseType.getTypeClass())) { } else if(Relation.class.isAssignableFrom(baseType.getTypeClass())) {
String sourceClass = typeDefinition.getSourceType(); @SuppressWarnings("rawtypes")
String sourceClass = ((RelationTypeDefinition) typeDefinition).getSourceType();
Vertex source = getVertex(orientGraph, sourceClass); Vertex source = getVertex(orientGraph, sourceClass);
String targetClass = typeDefinition.getTargetType(); @SuppressWarnings("rawtypes")
String targetClass = ((RelationTypeDefinition) typeDefinition).getTargetType();
Vertex target = getVertex(orientGraph, targetClass); Vertex target = getVertex(orientGraph, targetClass);
OrientEdge orientEdge = orientGraph.addEdge(null, source, target, typeDefinition.getName()); OrientEdge orientEdge = orientGraph.addEdge(null, source, target, typeDefinition.getName());

View File

@ -1,6 +1,6 @@
package org.gcube.informationsystem.resourceregistry.schema; 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.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;

View File

@ -14,7 +14,8 @@ import java.util.concurrent.Future;
import javax.activation.UnsupportedDataTypeException; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Property; 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.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.TypeBinder.PropertyDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.orientechnologies.orient.core.db.ODatabaseSession; import com.orientechnologies.orient.core.db.ODatabaseSession;
import com.orientechnologies.orient.core.exception.OSchemaException; import com.orientechnologies.orient.core.exception.OSchemaException;
import com.orientechnologies.orient.core.metadata.OMetadata; 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 <ISM extends ISManageable> TypeDefinition<ISM> getTypeDefinition(OClass oClass) throws SchemaException {
ODocument oDocument = ((OClassImpl) oClass).toStream(); ODocument oDocument = ((OClassImpl) oClass).toStream();
String json = oDocument.toJSON(); String json = oDocument.toJSON();
try { try {
@ -137,18 +137,18 @@ public class SchemaManagementImpl implements SchemaManagement {
} }
} }
protected static String getTypeDefinitionAsString(OClass oClass) throws SchemaException { protected static <ISM extends ISManageable> String getTypeDefinitionAsString(OClass oClass) throws SchemaException {
try { try {
TypeDefinition typeDefinition = getTypeDefinition(oClass); TypeDefinition<ISM> typeDefinition = getTypeDefinition(oClass);
return TypeBinder.serializeTypeDefinition(typeDefinition); return TypeBinder.serializeTypeDefinition(typeDefinition);
} catch(Exception e) { } catch(Exception e) {
throw new SchemaException(e); throw new SchemaException(e);
} }
} }
protected List<OClass> getSuperclassesAndCheckCompliancy(ODatabaseSession oDatabaseSession, protected <ISM extends ISManageable> List<OClass> getSuperclassesAndCheckCompliancy(ODatabaseSession oDatabaseSession,
TypeDefinition typeDefinition, String baseType) throws SchemaException { TypeDefinition<ISM> typeDefinition, String baseType) throws SchemaException {
Set<String> superClasses = typeDefinition.getSuperClasses(); Set<String> superClasses = typeDefinition.getSuperClasses();
if(baseType != null) { if(baseType != null) {
@ -188,8 +188,9 @@ public class SchemaManagementImpl implements SchemaManagement {
try { try {
logger.info("Trying to register {} {}", baseType.getName(), jsonSchema); logger.info("Trying to register {} {}", baseType.getName(), jsonSchema);
ObjectMapper mapper = new ObjectMapper();
TypeDefinition typeDefinition = mapper.readValue(jsonSchema, TypeDefinition.class); @SuppressWarnings("rawtypes")
TypeDefinition<? extends TypeDefinition> typeDefinition = TypeBinder.deserializeTypeDefinition(jsonSchema);
if(typeName.compareTo(typeDefinition.getName())!=0) { 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()); 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 <ISM extends ISManageable> String getSchema(String type, boolean includeSubtypes) throws SchemaNotFoundException, SchemaException {
ODatabaseSession oDatabaseSession = null; ODatabaseSession oDatabaseSession = null;
try { try {
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext(); AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
@ -351,7 +352,7 @@ public class SchemaManagementImpl implements SchemaManagement {
OSchema oSchema = oMetadata.getSchema(); OSchema oSchema = oMetadata.getSchema();
OClass baseOClass = getTypeSchema(oSchema, type, null); OClass baseOClass = getTypeSchema(oSchema, type, null);
List<TypeDefinition> typeDefinitions = new ArrayList<>(); List<TypeDefinition<ISM>> typeDefinitions = new ArrayList<>();
typeDefinitions.add(getTypeDefinition(baseOClass)); typeDefinitions.add(getTypeDefinition(baseOClass));
if(includeSubtypes) { if(includeSubtypes) {

View File

@ -3,14 +3,14 @@ package org.gcube.informationsystem.resourceregistry.utils;
import java.util.Date; import java.util.Date;
import java.util.UUID; 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; import com.orientechnologies.orient.core.record.impl.ODocument;
/** /**
* @author Luca Frosini (ISTI - CNR) * @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() { public HeaderOrient() {
super(Header.NAME); super(Header.NAME);

View File

@ -9,8 +9,8 @@ import java.util.UUID;
import org.gcube.common.authorization.library.provider.AuthorizationProvider; import org.gcube.common.authorization.library.provider.AuthorizationProvider;
import org.gcube.common.authorization.library.provider.ClientInfo; import org.gcube.common.authorization.library.provider.ClientInfo;
import org.gcube.common.authorization.library.utils.Caller; import org.gcube.common.authorization.library.utils.Caller;
import org.gcube.informationsystem.model.reference.ER; import org.gcube.informationsystem.base.reference.ER;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.base.reference.properties.Header;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,7 +31,7 @@ public class HeaderUtility {
private static final Logger logger = LoggerFactory.getLogger(HeaderUtility.class); private static final Logger logger = LoggerFactory.getLogger(HeaderUtility.class);
public static String getUser() { public static String getUser() {
String user = org.gcube.informationsystem.model.reference.properties.Header.UNKNOWN_USER; String user = Header.UNKNOWN_USER;
try { try {
Caller caller = AuthorizationProvider.instance.get(); Caller caller = AuthorizationProvider.instance.get();
if(caller != null) { if(caller != null) {

View File

@ -3,9 +3,9 @@ package org.gcube.informationsystem.resourceregistry.utils;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID; 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.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.model.reference.relations.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
@ -117,7 +117,7 @@ public class Utility {
return element; return element;
} }
public static <P extends Property> P getPropertyDocument(Class<P> clz, Element element, String property) public static <P extends BaseProperty> P getPropertyDocument(Class<P> clz, Element element, String property)
throws ResourceRegistryException { throws ResourceRegistryException {
try { try {
ODocument oDocument = element.getProperty(property); ODocument oDocument = element.getProperty(property);

View File

@ -4,10 +4,10 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.model.impl.entities.ContextImpl; import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
import org.gcube.informationsystem.model.impl.properties.HeaderImpl; import org.gcube.informationsystem.context.impl.entities.ContextImpl;
import org.gcube.informationsystem.model.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.ScopedTest;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException;

View File

@ -1,6 +1,6 @@
package org.gcube.informationsystem.resourceregistry.dbinitialization; 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.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode;

View File

@ -1,6 +1,6 @@
package org.gcube.informationsystem.resourceregistry.er; 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; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
public abstract class AbstractERManagementTest<Er extends ER> { public abstract class AbstractERManagementTest<Er extends ER> {

View File

@ -16,8 +16,8 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.gcube.common.authorization.library.provider.AuthorizationProvider; 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.EncryptedImpl;
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl; import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl; import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl;

View File

@ -22,13 +22,13 @@ import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; 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.properties.PropagationConstraintImpl;
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl; import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl; import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; 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;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; 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.CPUFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.ContainerStateFacet; 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;
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.NetworkingFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SimplePropertyFacet; 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.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.EService;
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode; import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory; import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
@ -379,9 +379,12 @@ public class SmartgearResourcesTest extends ScopedTest {
OperatingSystemMXBean mxbean = ManagementFactory OperatingSystemMXBean mxbean = ManagementFactory
.getOperatingSystemMXBean(); .getOperatingSystemMXBean();
@SuppressWarnings("restriction")
com.sun.management.OperatingSystemMXBean sunmxbean = (com.sun.management.OperatingSystemMXBean) mxbean; com.sun.management.OperatingSystemMXBean sunmxbean = (com.sun.management.OperatingSystemMXBean) mxbean;
@SuppressWarnings("restriction")
long freeMemory = sunmxbean.getFreePhysicalMemorySize() / 1048576; // in long freeMemory = sunmxbean.getFreePhysicalMemorySize() / 1048576; // in
// MB // MB
@SuppressWarnings("restriction")
long totalMemory = sunmxbean.getTotalPhysicalMemorySize() / 1048576; // in long totalMemory = sunmxbean.getTotalPhysicalMemorySize() / 1048576; // in
// MB // MB

View File

@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er.entity;
import java.util.UUID; 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.model.reference.entities.Facet;
import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.ScopedTest;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException;

View File

@ -5,17 +5,18 @@ package org.gcube.informationsystem.resourceregistry.schema;
import java.util.List; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; 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.properties.Property;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.TypeBinder; 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.facets.ContactFacet;
import org.gcube.resourcemanagement.model.reference.entities.resources.Actor; import org.gcube.resourcemanagement.model.reference.entities.resources.Actor;
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts; import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts;
@ -36,7 +37,7 @@ public class SchemaManagementImplTest {
@Test @Test
public void registerPropertyTypeSchema() throws Exception { public void registerPropertyTypeSchema() throws Exception {
Class<? extends Property> clz = Header.class; Class<? extends BaseProperty> clz = Header.class;
String json = TypeBinder.serializeType(clz); String json = TypeBinder.serializeType(clz);
logger.debug(json); logger.debug(json);
//new SchemaManagementImpl().create(json, AccessType.PROPERTY); //new SchemaManagementImpl().create(json, AccessType.PROPERTY);
@ -59,7 +60,7 @@ public class SchemaManagementImplTest {
public void getFacetSchema() throws Exception { public void getFacetSchema() throws Exception {
String json = new SchemaManagementImpl().read(ContactFacet.NAME, false); String json = new SchemaManagementImpl().read(ContactFacet.NAME, false);
logger.info(json); logger.info(json);
List<TypeDefinition> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json); List<TypeDefinition<ContactFacet>> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json);
logger.info("{}", typeDefinitions); logger.info("{}", typeDefinitions);
} }
@ -101,12 +102,12 @@ public class SchemaManagementImplTest {
boolean includeSubTypes = true; boolean includeSubTypes = true;
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
String list = schemaManagement.read(Property.NAME, includeSubTypes); String list = schemaManagement.read(BaseProperty.NAME, includeSubTypes);
logger.debug("{} list : {}", Property.NAME, list); logger.debug("{} list : {}", BaseProperty.NAME, list);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
List<TypeDefinition> typeDefinitions = mapper.readValue(list, List<TypeDefinition<BaseProperty>> typeDefinitions = mapper.readValue(list,
new TypeReference<List<TypeDefinition>>() { new TypeReference<List<TypeDefinition<BaseProperty>>>() {
}); });
logger.debug("{}", typeDefinitions); logger.debug("{}", typeDefinitions);