Class DefaultResourceImportHandler

java.lang.Object
org.cristalise.kernel.process.resource.DefaultResourceImportHandler
All Implemented Interfaces:
ResourceImportHandler

public class DefaultResourceImportHandler extends Object implements ResourceImportHandler
  • Constructor Details

  • Method Details

    • getCollections

      public CollectionArrayList getCollections(String name, String ns, String location, Integer version, TransactionKey transactionKey) throws Exception
      Description copied from interface: ResourceImportHandler
      Returns any collections that this Resource Item should contain.
      Specified by:
      getCollections in interface ResourceImportHandler
      Parameters:
      name - the name of the Resource Item
      ns - the namaspace of the module declaring the Resource Item
      location - the location of the XML file on the boot directory
      version - the version of the Resource Item
      Returns:
      CollectionArrayList
      Throws:
      Exception - something went wrong
    • getCollections

      public CollectionArrayList getCollections(String name, Integer version, Outcome outcome, TransactionKey transactionKey) throws Exception
      Description copied from interface: ResourceImportHandler
      Returns any collections that this Resource Item stored in the outcome should contain.
      Specified by:
      getCollections in interface ResourceImportHandler
      Parameters:
      name - the name of the Resource Item
      version - the version of the Resource Item
      outcome - Outcome containing the XML representing the Resource Item
      Returns:
      CollectionArrayList
      Throws:
      Exception - something went wrong
    • getTypeRoot

      public DomainPath getTypeRoot()
      Description copied from interface: ResourceImportHandler
      The directory context to search for existing resources. The name of the resource must be unique below this point.
      Specified by:
      getTypeRoot in interface ResourceImportHandler
      Returns:
      Root DomainPath
    • getName

      public String getName()
      Description copied from interface: ResourceImportHandler
      The name of the imported resource managed by the handler
      Specified by:
      getName in interface ResourceImportHandler
      Returns:
      The name of the imported resource managed by the handler
    • getPath

      public DomainPath getPath(String name, String ns)
      Description copied from interface: ResourceImportHandler
      Returns the DomainPath for a specific resource
      Specified by:
      getPath in interface ResourceImportHandler
      Parameters:
      name - - resource name
      ns - - module namespace
      Returns:
      DomainPath initialised
    • getResourceOutcome

      public Outcome getResourceOutcome(String name, String ns, String location, Integer version) throws InvalidDataException, ObjectNotFoundException
      Description copied from interface: ResourceImportHandler
      Generate the outcome that the resource should contain.
      Specified by:
      getResourceOutcome in interface ResourceImportHandler
      Parameters:
      name - the name of the resource
      ns - the namespace defined in the module
      location - the location of the resource file
      version - the specified version
      Returns:
      a set of outcomes to be synced with the resource item.
      Throws:
      InvalidDataException - - if the supplied resources are not valid
      ObjectNotFoundException - - data was not found to handle request
    • getPropDesc

      public PropertyDescriptionList getPropDesc()
      Description copied from interface: ResourceImportHandler
      Should return all of the Properties the resource Item will have on creation. The Property 'Name' will be created and populated automatically, even if not declared.
      Specified by:
      getPropDesc in interface ResourceImportHandler
      Returns:
      a PropertyDescriptionList - an arraylist of PropertyDescriptions
    • getWorkflowName

      public String getWorkflowName()
      Description copied from interface: ResourceImportHandler
      Gives the CompActDef name to instantiate to provide the workflow for this type of resource. Should be found in the CA typeroot (/desc/ActivityDesc/)
      Specified by:
      getWorkflowName in interface ResourceImportHandler
      Returns:
      String workflow name
    • createResource

      public DomainPath createResource(String ns, String itemName, int version, Outcome outcome, boolean reset, TransactionKey transactionKey) throws Exception
      Methods migrated from Bootstrap
      Specified by:
      createResource in interface ResourceImportHandler
      Parameters:
      ns - the NameSpace of the Module
      itemName - name of the resource Item
      version - version of the resource Item
      outcome - the Outcome to be used to create the resource
      reset - whether the resources shall be updated even if the current version was modified by someone other than the bootstrapper. Use system property 'Module.reset' or 'Module.${namespace}.reset' to control if bootstrap should overwrite the resource
      Returns:
      the DomainPath of the resource Item
      Throws:
      Exception - errors that are raised during the process
    • importResource

      public DomainPath importResource(String ns, String itemName, int version, ItemPath itemPath, String dataLocation, boolean reset, TransactionKey transactionKey) throws Exception
      Description copied from interface: ResourceImportHandler
      Creates or updates resource Item against a Module version, using a ResourceImportHandler configured finding the outcome at the given dataLocation.
      Specified by:
      importResource in interface ResourceImportHandler
      Parameters:
      ns - the NameSpace of the Module
      itemName - name of the resource Item
      version - version of the resource Item
      itemPath - the fixed UUID of the Item
      dataLocation - the location of the resource xml available from the classpath to be used as Outcome
      reset - whether the resources shall be updated even if the current version was modified by someone other than the bootstrapper. Use system property 'Module.reset' or 'Module.${namespace}.reset' to control if bootstrap should overwrite the resource
      Returns:
      the DomainPath of the resource Item
      Throws:
      Exception - errors that are raised during the process
    • importResource

      public DomainPath importResource(String ns, String itemName, int version, ItemPath itemPath, Outcome outcome, boolean reset, TransactionKey transactionKey) throws Exception
      Description copied from interface: ResourceImportHandler
      Verify a resource Item against a Module version, but supplies the resource outcomes directly instead of through a location lookup.
      Specified by:
      importResource in interface ResourceImportHandler
      Parameters:
      ns - the NameSpace of the Module
      itemName - name of the resource Item
      version - version of the resource Item
      itemPath - the fixed UUID of the Item
      reset - whether the resources shall be updated even if the current version was modified by someone other than the bootstrapper. Use system property 'Module.reset' or 'Module.${namespace}.reset' to control if bootstrap should overwrite the resource
      Returns:
      the DomainPath of the resource Item
      Throws:
      Exception - errors that are raised during the process
    • getResourceChangeDetails

      public String getResourceChangeDetails()
      Description copied from interface: ResourceImportHandler
      Reads the XML string that was created during the createResource() and importResource() methods
      Specified by:
      getResourceChangeDetails in interface ResourceImportHandler
      Returns:
      xml string
    • getResourceChangeStatus

      public ResourceImportHandler.Status getResourceChangeStatus()
      Specified by:
      getResourceChangeStatus in interface ResourceImportHandler