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 Details

    • logger

      protected org.slf4j.Logger logger
      Logger
    • type

      protected String type
    • instanceUUID

      protected UUID 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

      protected R extends org.gcube.informationsystem.model.reference.entities.Resource resource
    • instance

      protected I extends Instance instance
    • mandatoryRelatedResources

      protected List<org.gcube.informationsystem.model.reference.entities.Resource> mandatoryRelatedResources
    • derivatedRelatedResourceGroups

      protected Set<DerivatedRelatedResourceGroup<I extends Instance>> derivatedRelatedResourceGroups
    • mapper

      protected org.gcube.com.fasterxml.jackson.databind.ObjectMapper mapper
    • targetContext

      protected TargetContext targetContext
  • Constructor Details

    • InstanceAnalyser

      public InstanceAnalyser()
    • InstanceAnalyser

      public InstanceAnalyser(String type, UUID instanceUUID)
  • Method Details

    • getName

      public String getName()
      Returns:
      the name of the analyser
    • getType

      public String getType()
      Returns:
      the supported type of the analyser
    • setType

      public void setType(String type)
    • getTypeClass

      public abstract Class<R> getTypeClass()
    • getInstanceClass

      public abstract Class<I> getInstanceClass()
    • getInstanceUUID

      public UUID getInstanceUUID()
    • setInstanceUUID

      public void setInstanceUUID(UUID instanceUUID)
    • setTargetContext

      public void setTargetContext(TargetContext targetContext)
    • getDescription

      public String 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

      public Integer 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.WebApplicationException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setResource

      public void setResource(R resource)
    • getDerivatedRelatedResourceGroup

      protected abstract Set<DerivatedRelatedResourceGroup<I>> getDerivatedRelatedResourceGroup() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Return the set of Derivated Related Resources (D-RR) to be analysed
      Returns:
      the set of Derivated Related Resources (D-RR)
      Throws:
      jakarta.ws.rs.WebApplicationException
      org.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.WebApplicationException
      org.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.ResourceRegistryException
      Return 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.WebApplicationException
      org.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.ResourceRegistryException
      Return the list of Mandatory Related Resources (M-RR)
      Returns:
      the list of Mandatory Related Resources (M-RR)
      Throws:
      jakarta.ws.rs.WebApplicationException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getDerivatedRelatedResources

      public Set<DerivatedRelatedResourceGroup<I>> getDerivatedRelatedResources() throws jakarta.ws.rs.WebApplicationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      This 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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setInstance

      public void setInstance(I instance)
    • readToRemove

      public I readToRemove() throws jakarta.ws.rs.WebApplicationException
      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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getDRRMap

    • 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.WebApplicationException
      org.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.WebApplicationException
      org.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.WebApplicationException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • remove

      public I remove() throws jakarta.ws.rs.WebApplicationException
      Throws:
      jakarta.ws.rs.WebApplicationException