Reorganizing packages of IS Model

This commit is contained in:
Luca Frosini 2023-02-03 14:39:25 +01:00
parent e5329b1627
commit 1f6d21b9a0
32 changed files with 145 additions and 131 deletions

View File

@ -7,7 +7,7 @@ import java.io.StringWriter;
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName; import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -6,7 +6,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.impl.ElementImpl; import org.gcube.informationsystem.base.impl.ElementImpl;
import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -11,7 +11,7 @@ import org.gcube.informationsystem.base.impl.ElementImpl;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -1,22 +1,18 @@
/** /**
* *
*/ */
package org.gcube.informationsystem.utils.discovery; package org.gcube.informationsystem.discovery;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -24,9 +20,9 @@ import org.slf4j.LoggerFactory;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public class ElementSpecilizationDiscovery<E extends Element> { public class Discovery<E extends Element> {
private static Logger logger = LoggerFactory.getLogger(ElementSpecilizationDiscovery.class); public static Logger logger = LoggerFactory.getLogger(Discovery.class);
protected final Class<E> root; protected final Class<E> root;
protected final List<Package> packages; protected final List<Package> packages;
@ -37,11 +33,11 @@ public class ElementSpecilizationDiscovery<E extends Element> {
return discovered; return discovered;
} }
public ElementSpecilizationDiscovery(Class<E> root) { public Discovery(Class<E> root) {
this(root, true); this(root, true);
} }
public ElementSpecilizationDiscovery(Class<E> root, boolean includeRootPackage) { public Discovery(Class<E> root, boolean includeRootPackage) {
this.root = root; this.root = root;
this.packages = new ArrayList<>(); this.packages = new ArrayList<>();
this.includeRootPackage = includeRootPackage; this.includeRootPackage = includeRootPackage;
@ -135,48 +131,4 @@ public class ElementSpecilizationDiscovery<E extends Element> {
} }
public static void manageISM(SchemaAction schemaAction, List<Package> packages) throws Exception {
if(Objects.nonNull(packages) && packages.size() > 0) {
manageISM(schemaAction, packages.stream().toArray(Package[]::new));
} else {
manageISM(schemaAction);
}
}
@SuppressWarnings("unchecked")
public static void manageISM(SchemaAction schemaAction, Package... packages) throws Exception {
ElementSpecilizationDiscovery<PropertyElement> propertyDiscovery = new ElementSpecilizationDiscovery<>(PropertyElement.class);
if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> propertyDiscovery.addPackage(p));
}
propertyDiscovery.discover();
for(Class<? extends PropertyElement> property : propertyDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", property);
schemaAction.managePropertyClass(property);
}
ElementSpecilizationDiscovery<EntityElement> entityDiscovery = new ElementSpecilizationDiscovery<>(EntityElement.class);
if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> entityDiscovery.addPackage(p));
}
entityDiscovery.discover();
for(Class<? extends EntityElement> entity : entityDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", entity);
schemaAction.manageEntityClass(entity);
}
@SuppressWarnings("rawtypes")
ElementSpecilizationDiscovery<RelationElement> relationDiscovery = new ElementSpecilizationDiscovery<RelationElement>(RelationElement.class);
if(Objects.nonNull(packages))
Arrays.stream(packages).forEach(p -> relationDiscovery.addPackage(p));
relationDiscovery.discover();
for(@SuppressWarnings("rawtypes")
Class<? extends RelationElement> relation : relationDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", relation);
schemaAction.manageRelationClass(relation);
}
}
} }

View File

@ -0,0 +1,92 @@
package org.gcube.informationsystem.discovery;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.ServiceLoader;
import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.types.reference.Type;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DiscoveryUtility {
public static Logger logger = LoggerFactory.getLogger(DiscoveryUtility.class);
public static List<Package> discoverPackages(){
List<Package> packages = new ArrayList<Package>();
Class<Type> tdClz = Type.class;
packages.add(tdClz.getPackage());
AccessType[] accessTypes = AccessType.values();
for(AccessType accessType : accessTypes) {
Class<Element> clz = accessType.getTypeClass();
packages.add(clz.getPackage());
}
ServiceLoader<? extends RegistrationProvider> regsitrationProviders = ServiceLoader
.load(RegistrationProvider.class);
for(RegistrationProvider registrationProvider : regsitrationProviders) {
packages.addAll(registrationProvider.getPackagesToRegister());
}
return packages;
}
public static void discover(SchemaAction schemaAction) throws Exception {
List<Package> packages = DiscoveryUtility.discoverPackages();
DiscoveryUtility.manageISM(schemaAction , packages);
}
@SuppressWarnings("unchecked")
public static void manageISM(SchemaAction schemaAction, Package... packages) throws Exception {
Discovery<PropertyElement> propertyDiscovery = new Discovery<>(PropertyElement.class);
if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> propertyDiscovery.addPackage(p));
}
propertyDiscovery.discover();
for(Class<? extends PropertyElement> property : propertyDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", property);
schemaAction.managePropertyClass(property);
}
Discovery<EntityElement> entityDiscovery = new Discovery<>(EntityElement.class);
if(Objects.nonNull(packages)) {
Arrays.stream(packages).forEach(p -> entityDiscovery.addPackage(p));
}
entityDiscovery.discover();
for(Class<? extends EntityElement> entity : entityDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", entity);
schemaAction.manageEntityClass(entity);
}
@SuppressWarnings("rawtypes")
Discovery<RelationElement> relationDiscovery = new Discovery<RelationElement>(RelationElement.class);
if(Objects.nonNull(packages))
Arrays.stream(packages).forEach(p -> relationDiscovery.addPackage(p));
relationDiscovery.discover();
for(@SuppressWarnings("rawtypes")
Class<? extends RelationElement> relation : relationDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", relation);
schemaAction.manageRelationClass(relation);
}
}
public static void manageISM(SchemaAction schemaAction, List<Package> packages) throws Exception {
if(Objects.nonNull(packages) && packages.size() > 0) {
manageISM(schemaAction, packages.stream().toArray(Package[]::new));
} else {
manageISM(schemaAction);
}
}
}

View File

@ -1,7 +1,7 @@
/** /**
* *
*/ */
package org.gcube.informationsystem.utils.discovery; package org.gcube.informationsystem.discovery;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View File

@ -1,20 +1,25 @@
package org.gcube.informationsystem.utils.discovery; package org.gcube.informationsystem.discovery;
import java.util.List; import java.util.List;
/** /**
* Any model which requires to register the defined types from marshalling and unmarshalling * Any model requires to register the defined types.
* must implement this interface returning the list of packages containing the interfaces * To accomplish this, it must implement this interface
* returning the list of packages containing the interfaces
* representing the model. * representing the model.
* *
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public interface RegistrationProvider { public interface RegistrationProvider {
/**
* The name of the Model
* @return
*/
public String getModelName(); public String getModelName();
/** /**
* This method must return the list of packages to be registered from marshalling/unmarshalling * This method must return the list of packages to be registered
* @return the list of packages to register * @return the list of packages to register
*/ */
public List<Package> getPackagesToRegister(); public List<Package> getPackagesToRegister();

View File

@ -1,7 +1,7 @@
/** /**
* *
*/ */
package org.gcube.informationsystem.utils.discovery; package org.gcube.informationsystem.discovery;
import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;

View File

@ -1,4 +1,4 @@
package org.gcube.informationsystem.utils.knowledge; package org.gcube.informationsystem.knowledge;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;

View File

@ -1,4 +1,4 @@
package org.gcube.informationsystem.utils.knowledge; package org.gcube.informationsystem.knowledge;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -1,4 +1,4 @@
package org.gcube.informationsystem.utils.knowledge; package org.gcube.informationsystem.knowledge;
import java.util.HashMap; import java.util.HashMap;
import java.util.Set; import java.util.Set;

View File

@ -1,4 +1,4 @@
package org.gcube.informationsystem.utils.knowledge; package org.gcube.informationsystem.knowledge;
import java.util.Collection; import java.util.Collection;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;

View File

@ -13,7 +13,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -17,7 +17,7 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
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;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -6,10 +6,10 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonAnyGetter;
import org.gcube.com.fasterxml.jackson.annotation.JsonAnySetter; import org.gcube.com.fasterxml.jackson.annotation.JsonAnySetter;
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.gcube.com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.gcube.informationsystem.base.reference.SchemaMixedElement; import org.gcube.informationsystem.base.reference.SchemaMixedElement;
import org.gcube.informationsystem.serialization.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.utils.Version; import org.gcube.informationsystem.utils.Version;
/** /**

View File

@ -12,9 +12,9 @@ import org.gcube.com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.gcube.informationsystem.base.reference.SchemaMixedElement; import org.gcube.informationsystem.base.reference.SchemaMixedElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.model.impl.properties.PropertyImpl; import org.gcube.informationsystem.model.impl.properties.PropertyImpl;
import org.gcube.informationsystem.serialization.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.utils.Version; import org.gcube.informationsystem.utils.Version;
/** /**

View File

@ -17,11 +17,11 @@ import org.gcube.informationsystem.model.reference.ERElement;
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.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
import org.gcube.informationsystem.serialization.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.Change; import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata; import org.gcube.informationsystem.types.reference.TypeMetadata;
import org.gcube.informationsystem.utils.AdditionalPropertiesSerializer;
import org.gcube.informationsystem.utils.Version; import org.gcube.informationsystem.utils.Version;
/** /**

View File

@ -1,4 +1,4 @@
package org.gcube.informationsystem.utils; package org.gcube.informationsystem.serialization;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

View File

@ -1,7 +1,7 @@
/** /**
* *
*/ */
package org.gcube.informationsystem.utils; package org.gcube.informationsystem.serialization;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package org.gcube.informationsystem.utils; package org.gcube.informationsystem.serialization;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -28,11 +28,11 @@ import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
import org.gcube.com.fasterxml.jackson.databind.node.TextNode; import org.gcube.com.fasterxml.jackson.databind.node.TextNode;
import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.discovery.DiscoveryUtility;
import org.gcube.informationsystem.discovery.RegistrationProvider;
import org.gcube.informationsystem.discovery.SchemaAction;
import org.gcube.informationsystem.types.TypeMapper; import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.utils.discovery.ElementSpecilizationDiscovery;
import org.gcube.informationsystem.utils.discovery.RegistrationProvider;
import org.gcube.informationsystem.utils.discovery.SchemaAction;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -103,7 +103,7 @@ public abstract class ElementMapper {
public static void registerPackages(List<Package> packages) { public static void registerPackages(List<Package> packages) {
SchemaAction schemaAction = new ElementMappingAction(); SchemaAction schemaAction = new ElementMappingAction();
try { try {
ElementSpecilizationDiscovery.manageISM(schemaAction, packages); DiscoveryUtility.manageISM(schemaAction, packages);
} catch(Exception e) { } catch(Exception e) {
logger.error("Error registering types", e); logger.error("Error registering types", e);
} }
@ -112,7 +112,7 @@ public abstract class ElementMapper {
public static void registerPackages(Package... packages) { public static void registerPackages(Package... packages) {
SchemaAction schemaAction = new ElementMappingAction(); SchemaAction schemaAction = new ElementMappingAction();
try { try {
ElementSpecilizationDiscovery.manageISM(schemaAction, packages); DiscoveryUtility.manageISM(schemaAction, packages);
} catch(Exception e) { } catch(Exception e) {
logger.error("Error registering types", e); logger.error("Error registering types", e);
} }

View File

@ -1,12 +1,12 @@
/** /**
* *
*/ */
package org.gcube.informationsystem.utils; package org.gcube.informationsystem.serialization;
import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.utils.discovery.SchemaAction; import org.gcube.informationsystem.discovery.SchemaAction;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -13,11 +13,11 @@ 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.Header;
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate; import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.impl.TypeImpl; import org.gcube.informationsystem.types.impl.TypeImpl;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.FacetType; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.utils.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -9,11 +9,11 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable; import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.impl.TypeImpl; import org.gcube.informationsystem.types.impl.TypeImpl;
import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.utils.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -14,13 +14,13 @@ 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.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.serialization.ElementMapper;
import org.gcube.informationsystem.types.impl.TypeImpl; import org.gcube.informationsystem.types.impl.TypeImpl;
import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl; import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.ElementMapper;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)

View File

@ -1,39 +0,0 @@
package org.gcube.informationsystem.utils.discovery;
import java.util.ArrayList;
import java.util.List;
import java.util.ServiceLoader;
import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.types.reference.Type;
public class Discovery {
public static List<Package> discoverPackages(){
List<Package> packages = new ArrayList<Package>();
Class<Type> tdClz = Type.class;
packages.add(tdClz.getPackage());
AccessType[] accessTypes = AccessType.values();
for(AccessType accessType : accessTypes) {
Class<Element> clz = accessType.getTypeClass();
packages.add(clz.getPackage());
}
ServiceLoader<? extends RegistrationProvider> regsitrationProviders = ServiceLoader
.load(RegistrationProvider.class);
for(RegistrationProvider registrationProvider : regsitrationProviders) {
packages.addAll(registrationProvider.getPackagesToRegister());
}
return packages;
}
public static void discover(SchemaAction schemaAction) throws Exception {
List<Package> packages = Discovery.discoverPackages();
ElementSpecilizationDiscovery.manageISM(schemaAction , packages);
}
}

View File

@ -2,7 +2,7 @@ package org.gcube.informationsystem.model.impl.entities;
import org.gcube.informationsystem.contexts.impl.entities.ContextImpl; import org.gcube.informationsystem.contexts.impl.entities.ContextImpl;
import org.gcube.informationsystem.contexts.reference.entities.Context; import org.gcube.informationsystem.contexts.reference.entities.Context;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -9,8 +9,8 @@ import org.gcube.informationsystem.ContextTest;
import org.gcube.informationsystem.base.reference.Element; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.model.reference.properties.Encrypted; import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.TypeMapper; import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.utils.ElementMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@ -10,7 +10,7 @@ import org.gcube.com.fasterxml.jackson.core.JsonParseException;
import org.gcube.com.fasterxml.jackson.databind.JsonMappingException; import org.gcube.com.fasterxml.jackson.databind.JsonMappingException;
import org.gcube.informationsystem.model.reference.properties.Header; 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.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@ -12,7 +12,7 @@ import org.gcube.informationsystem.model.reference.properties.PropagationConstra
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
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.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;

View File

@ -10,7 +10,7 @@ import org.gcube.informationsystem.queries.templates.impl.entities.QueryTemplate
import org.gcube.informationsystem.queries.templates.impl.properties.TemplateVariableImpl; import org.gcube.informationsystem.queries.templates.impl.properties.TemplateVariableImpl;
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate; import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable; import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.informationsystem.serialization.ElementMapper;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -17,6 +17,7 @@ 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.queries.templates.reference.entities.QueryTemplate; import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable; import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
import org.gcube.informationsystem.serialization.ElementMapper;
import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.FacetType; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceType; import org.gcube.informationsystem.types.reference.entities.ResourceType;
@ -26,7 +27,6 @@ import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationType; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.informationsystem.utils.Version; import org.gcube.informationsystem.utils.Version;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -10,6 +10,10 @@ import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.discovery.Discovery;
import org.gcube.informationsystem.discovery.DiscoveryUtility;
import org.gcube.informationsystem.discovery.RegistrationProvider;
import org.gcube.informationsystem.discovery.SchemaAction;
import org.gcube.informationsystem.types.TypeMapper; import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
@ -29,7 +33,7 @@ public class ISMDiscoveryTest {
@Test @Test
public void testISMDIscovery() { public void testISMDIscovery() {
ElementSpecilizationDiscovery<PropertyElement> propertyDiscovery = new ElementSpecilizationDiscovery<>(PropertyElement.class); Discovery<PropertyElement> propertyDiscovery = new Discovery<>(PropertyElement.class);
propertyDiscovery.analizeISM(PropertyType.class); propertyDiscovery.analizeISM(PropertyType.class);
} }
@ -129,7 +133,7 @@ public class ISMDiscoveryTest {
}; };
ElementSpecilizationDiscovery.manageISM(schemaAction , packages); DiscoveryUtility.manageISM(schemaAction , packages);
} }