Class InstanceAnalyser<R extends org.gcube.informationsystem.model.reference.entities.Resource,I extends Instance>
java.lang.Object
org.gcube.resourcemanagement.analyser.InstanceAnalyser<R,I>
public abstract class InstanceAnalyser<R extends org.gcube.informationsystem.model.reference.entities.Resource,I extends Instance>
extends Object
- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.gcube.informationsystem.model.reference.entities.Resourceprotected org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientprotected Set<DerivatedRelatedResourceGroup<I>>protected Iprotected UUIDprotected intprotected org.slf4j.LoggerLoggerprotected booleanprotected List<org.gcube.informationsystem.model.reference.entities.Resource>protected org.gcube.com.fasterxml.jackson.databind.ObjectMapperprotected org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherprotected Rprotected TargetContextprotected org.gcube.informationsystem.resourceregistry.queries.templates.ResourceRegistryQueryTemplateClientprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd()protected DerivatedRelatedResourceGroup<Instance>addDerivatedRelatedResourceGroup(DerivatedRelatedResourceGroup<Instance> requested, DerivatedRelatedResourceGroup<Instance> expected) protected Set<DerivatedRelatedResourceGroup<Instance>>addDerivatedRelatedResources(I expectedInstance) addMandatoryRelatedResources(I expectedInstance) protected List<org.gcube.informationsystem.base.reference.IdentifiableElement>protected List<org.gcube.informationsystem.model.reference.ERElement>protected List<org.gcube.informationsystem.model.reference.entities.Resource>executeQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode query) protected List<org.gcube.informationsystem.model.reference.entities.Resource>executeQueryTemplate(org.gcube.informationsystem.queries.templates.reference.properties.QueryTemplateReference queryTemplateReference) org.gcube.informationsystem.model.reference.entities.Resourceprotected abstract Set<DerivatedRelatedResourceGroup<I>>Return the set of Derivated Related Resources (D-RR) to be analysedThis function is used to discover the Derivated Related Resources (D-RR) analyzing the DiscoveryFacets of the instanceprotected Map<String,DerivatedRelatedResourceGroup<Instance>> getDRRMap(Collection<DerivatedRelatedResourceGroup<Instance>> derivatedRelatedResources) intgetLevel()List<org.gcube.informationsystem.model.reference.entities.Resource>Return the list of Mandatory Related Resources (M-RR)protected org.gcube.informationsystem.queries.templates.reference.properties.QueryTemplateReferencegetName()protected abstract List<org.gcube.informationsystem.base.reference.IdentifiableElement>Return the set of new instances to create to return to the client which has to analyse and to provide the real instances to creategetType()booleanread(org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation operation) protected Iremove()voidsetAncestor(org.gcube.informationsystem.model.reference.entities.Resource ancestor) voidsetInstance(I instance) voidsetInstanceUUID(UUID instanceUUID) voidsetLevel(int level) voidsetResource(R resource) voidsetTargetContext(TargetContext targetContext) voidprotected Map<String,DerivatedRelatedResourceGroup<Instance>> validateDerivatedRelatedResources(I expectedInstance) protected abstract List<org.gcube.informationsystem.base.reference.IdentifiableElement>validateInstancesToCreate(List<org.gcube.informationsystem.base.reference.IdentifiableElement> newInstances) Return the set of new instances to create during add to context operation It get the set of instance to create from client, aanlyse it and reate the real instance.validateMandatoryRelatedResources(I expectedInstance)
-
Field Details
-
logger
protected org.slf4j.Logger loggerLogger -
type
-
instanceUUID
-
client
protected org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient client -
publisher
protected org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher publisher -
templateClient
protected org.gcube.informationsystem.resourceregistry.queries.templates.ResourceRegistryQueryTemplateClient templateClient -
level
protected int level -
mandatory
protected boolean mandatory -
ancestor
protected org.gcube.informationsystem.model.reference.entities.Resource ancestor -
resource
-
instance
-
mandatoryRelatedResources
protected List<org.gcube.informationsystem.model.reference.entities.Resource> mandatoryRelatedResources -
derivatedRelatedResourceGroups
-
mapper
protected org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapper -
targetContext
-
-
Constructor Details
-
InstanceAnalyser
public InstanceAnalyser() -
InstanceAnalyser
-
-
Method Details
-
getName
- Returns:
- the name of the analyser
-
getType
- Returns:
- the supported type of the analyser
-
setType
-
getTypeClass
-
getInstanceClass
-
getInstanceUUID
-
setInstanceUUID
-
setTargetContext
-
getDescription
- Returns:
- the description of the analyser
-
polymorphic
public boolean polymorphic()- Returns:
- true of the analyser supports instances of derivated type aparte the one specified in the getType method.
-
getPriority
- Returns:
- the priority of the analyser. When two analysers are available for the same type, the one with the highest priority is used first. By default the priority is 100 so we have room for other analysers to be used first. It is strongly reccomended to use 50 as first option and then 25 to leave room for others with higher priority to be used first in respect to the one aleady developed. This avoid to released a analyser just to change the priority.
-
getAncestor
public org.gcube.informationsystem.model.reference.entities.Resource getAncestor() -
setAncestor
public void setAncestor(org.gcube.informationsystem.model.reference.entities.Resource ancestor) -
getLevel
public int getLevel() -
setLevel
public void setLevel(int level) -
getResource
public R getResource() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
setResource
-
getDerivatedRelatedResourceGroup
protected abstract Set<DerivatedRelatedResourceGroup<I>> getDerivatedRelatedResourceGroup() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturn the set of Derivated Related Resources (D-RR) to be analysed- Returns:
- the set of Derivated Related Resources (D-RR)
- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
validateInstancesToCreate
protected abstract List<org.gcube.informationsystem.base.reference.IdentifiableElement> validateInstancesToCreate(List<org.gcube.informationsystem.base.reference.IdentifiableElement> newInstances) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Return the set of new instances to create during add to context operation It get the set of instance to create from client, aanlyse it and reate the real instance.- Parameters:
newInstances-- Returns:
- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getNewInstances
protected abstract List<org.gcube.informationsystem.base.reference.IdentifiableElement> getNewInstances() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturn the set of new instances to create to return to the client which has to analyse and to provide the real instances to create- Returns:
- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getMandatoryRelatedResourcesQTR
protected org.gcube.informationsystem.queries.templates.reference.properties.QueryTemplateReference getMandatoryRelatedResourcesQTR() -
getMandatoryRelatedResources
public List<org.gcube.informationsystem.model.reference.entities.Resource> getMandatoryRelatedResources() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturn the list of Mandatory Related Resources (M-RR)- Returns:
- the list of Mandatory Related Resources (M-RR)
- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getDerivatedRelatedResources
public Set<DerivatedRelatedResourceGroup<I>> getDerivatedRelatedResources() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionThis function is used to discover the Derivated Related Resources (D-RR) analyzing the DiscoveryFacets of the instance- Returns:
- the set of D-RR
- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
executeQuery
protected List<org.gcube.informationsystem.model.reference.entities.Resource> executeQuery(org.gcube.com.fasterxml.jackson.databind.JsonNode query) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
executeQueryTemplate
protected List<org.gcube.informationsystem.model.reference.entities.Resource> executeQueryTemplate(org.gcube.informationsystem.queries.templates.reference.properties.QueryTemplateReference queryTemplateReference) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
read
public I read(org.gcube.informationsystem.resourceregistry.api.rest.SharingPath.SharingOperation operation) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
readToAdd
protected I readToAdd() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getInstance
public I getInstance() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
setInstance
-
readToRemove
- Throws:
jakarta.ws.rs.WebApplicationException
-
executeAdd
protected List<org.gcube.informationsystem.model.reference.ERElement> executeAdd() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
createNewInstances
protected List<org.gcube.informationsystem.base.reference.IdentifiableElement> createNewInstances() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
validateMandatoryRelatedResources
protected Set<Instance> validateMandatoryRelatedResources(I expectedInstance) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addMandatoryRelatedResources
protected Set<Instance> addMandatoryRelatedResources(I expectedInstance) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addDerivatedRelatedResourceGroup
protected DerivatedRelatedResourceGroup<Instance> addDerivatedRelatedResourceGroup(DerivatedRelatedResourceGroup<Instance> requested, DerivatedRelatedResourceGroup<Instance> expected) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getDRRMap
protected Map<String,DerivatedRelatedResourceGroup<Instance>> getDRRMap(Collection<DerivatedRelatedResourceGroup<Instance>> derivatedRelatedResources) -
validateDerivatedRelatedResources
protected Map<String,DerivatedRelatedResourceGroup<Instance>> validateDerivatedRelatedResources(I expectedInstance) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addDerivatedRelatedResources
protected Set<DerivatedRelatedResourceGroup<Instance>> addDerivatedRelatedResources(I expectedInstance) throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
add
public I add() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
jakarta.ws.rs.WebApplicationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
remove
- Throws:
jakarta.ws.rs.WebApplicationException
-