Interface HandlerIO

    • Method Detail

      • addInIOParameters

        void addInIOParameters​(java.util.List<IOParameter> list)
        Add Input parameters
        Parameters:
        list -
        Throws:
        java.lang.IllegalArgumentException - if an error occurs
      • addOutIOParameters

        void addOutIOParameters​(java.util.List<IOParameter> list)
        Add Output parameters
        Parameters:
        list -
        Throws:
        java.lang.IllegalArgumentException - if an error occurs
      • reset

        void reset()
        Reset after each Action
      • getInput

        java.util.List<java.lang.Object> getInput()
        Returns:
        list of input
      • getInput

        java.lang.Object getInput​(int rank)
        Return one Object from input
        Parameters:
        rank -
        Returns:
        the rank-th object
      • getInput

        <T> T getInput​(int rank,
                       java.lang.Class<T> type)
        Return one Object casted to type from input
        Parameters:
        rank -
        Returns:
        the rank-th object
      • getOutput

        java.util.List<ProcessingUri> getOutput()
        Returns:
        list of output
      • getOutput

        ProcessingUri getOutput​(int rank)
        Return one ProcessingUri from output
        Parameters:
        rank -
        Returns:
        the rank-th ProcessingUri
      • addOutputResult

        HandlerIO addOutputResult​(int rank,
                                  java.lang.Object object,
                                  boolean asyncIO)
                           throws ProcessingException
        Add one output result (no delete)
        Parameters:
        rank - the position in the output
        object - the result to store (WORKSPACE to workspace and must be a File, MEMORY to memory whatever it is)
        asyncIO - asynchronously send to the workspace
        Returns:
        this
        Throws:
        ProcessingException
        java.lang.IllegalArgumentException
      • addOutputResult

        HandlerIO addOutputResult​(int rank,
                                  java.lang.Object object,
                                  boolean deleteLocal,
                                  boolean asyncIO)
                           throws ProcessingException
        Add one output result
        Parameters:
        rank - the position in the output
        object - the result to store (WORKSPACE to workspace and must be a File, MEMORY to memory whatever it is)
        deleteLocal - if true, will delete the local file in case of WORKSPACE only
        asyncIO - asynchronously send to the workspace
        Returns:
        this
        Throws:
        ProcessingException
        java.lang.IllegalArgumentException
      • getContainerName

        java.lang.String getContainerName()
        Returns:
        the container Name
      • getWorkerId

        java.lang.String getWorkerId()
        Returns:
        the worker Id
      • getNewLocalFile

        java.io.File getNewLocalFile​(java.lang.String name)
        Parameters:
        name -
        Returns:
        a File pointing to a local path in Tmp directory under protected Worker instance space
      • getUriList

        java.util.List<java.net.URI> getUriList​(java.lang.String containerName,
                                                java.lang.String folderName)
                                         throws ProcessingException
        Parameters:
        containerName -
        folderName -
        Returns:
        List a list of uri of object in SIP folder
        Throws:
        ProcessingException
      • checkHandlerIO

        boolean checkHandlerIO​(int outputNumber,
                               java.util.List<java.lang.Class<?>> clasz)
        Check if input and output have the very same number of elements and for Input the associated types
        Parameters:
        outputNumber - the number of outputArguments
        clasz - the list of Class that should be in the InputParameters
        Returns:
        true if everything ok
      • transferFileToWorkspace

        void transferFileToWorkspace​(java.lang.String workspacePath,
                                     java.io.File sourceFile,
                                     boolean toDelete,
                                     boolean asyncIO)
                              throws ProcessingException
        Helper to write a file to Workspace

        To be used when not specified within the Output Parameters
        Parameters:
        workspacePath - path within the workspath, without the container (implicit)
        sourceFile - the source file to write
        toDelete - if True, will delete the local file
        asyncIO - asynchronously send to the workspace
        Throws:
        ProcessingException
      • transferInputStreamToWorkspace

        void transferInputStreamToWorkspace​(java.lang.String workspacePath,
                                            java.io.InputStream inputStream,
                                            java.nio.file.Path filePath,
                                            boolean asyncIO)
                                     throws ProcessingException
        Helper to write an InputStream to Workspace

        To be used when not specified within the Output Parameters
        Parameters:
        workspacePath - path within the workspath, without the container (implicit)
        inputStream - the source InputStream to write
        asyncIO - asynchronously send to the workspace
        Throws:
        ProcessingException
      • getFilesWithParamsFromWorkspace

        java.util.Map<java.lang.String,​java.lang.Long> getFilesWithParamsFromWorkspace​(java.lang.String containerName,
                                                                                             java.lang.String folderName)
                                                                                      throws ProcessingException
        get Map of File With Params From folder in Workspace
        Parameters:
        containerName -
        folderName -
        Returns:
        Throws:
        ProcessingException
      • consumeAnyEntityAndClose

        void consumeAnyEntityAndClose​(javax.ws.rs.core.Response response)
        Consume any entity and close response
        Parameters:
        response -
      • getJsonFromWorkspace

        com.fasterxml.jackson.databind.JsonNode getJsonFromWorkspace​(java.lang.String jsonFilePath)
                                                              throws ProcessingException
        Retrieve a json file as a JsonNode from the workspace.
        Parameters:
        jsonFilePath - path in workspace of the json File
        Returns:
        JsonNode of the json file
        Throws:
        ProcessingException - throws when error occurs
      • transferJsonToWorkspace

        void transferJsonToWorkspace​(java.lang.String collectionName,
                                     java.lang.String workspacePath,
                                     com.fasterxml.jackson.databind.JsonNode jsonNode,
                                     boolean toDelete,
                                     boolean asyncIO)
                              throws ProcessingException
        Helper to convert and write a file to Workspace

        Parameters:
        collectionName - : collection type
        workspacePath - path within the workspacepath, without the container (implicit)
        jsonNode - the json file to write
        toDelete - if True, will delete the local file
        asyncIO - asynchronously send to the workspace
        Throws:
        ProcessingException
      • unzipInputStreamOnWorkspace

        void unzipInputStreamOnWorkspace​(java.lang.String container,
                                         java.lang.String folderName,
                                         java.lang.String archiveMimeType,
                                         java.io.InputStream uploadedInputStream,
                                         boolean asyncIO)
                                  throws ContentAddressableStorageException
        Parameters:
        container -
        folderName -
        archiveMimeType -
        uploadedInputStream -
        asyncIO - asynchronously send and unzip file to/in the workspace
        Throws:
        ContentAddressableStorageException
      • setCurrentObjectId

        void setCurrentObjectId​(java.lang.String currentObjectId)