Class RestDSpaceRunnableHandler

  • All Implemented Interfaces:
    org.dspace.scripts.handler.DSpaceRunnableHandler

    public class RestDSpaceRunnableHandler
    extends Object
    implements org.dspace.scripts.handler.DSpaceRunnableHandler
    The DSpaceRunnableHandler dealing with Scripts started from the REST api
    • Constructor Detail

      • RestDSpaceRunnableHandler

        public RestDSpaceRunnableHandler​(org.dspace.eperson.EPerson ePerson,
                                         String scriptName,
                                         List<org.dspace.scripts.DSpaceCommandLineParameter> parameters)
        This constructor will initialise the handler with the process created from the parameters
        Parameters:
        ePerson - The eperson that creates the process
        scriptName - The name of the script for which is a process will be created
        parameters - The parameters for this process
    • Method Detail

      • start

        public void start()
        Specified by:
        start in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • handleCompletion

        public void handleCompletion()
        Specified by:
        handleCompletion in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • handleException

        public void handleException​(Exception e)
        Specified by:
        handleException in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • handleException

        public void handleException​(String message)
        Specified by:
        handleException in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • handleException

        public void handleException​(String message,
                                    Exception e)
        Specified by:
        handleException in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • logDebug

        public void logDebug​(String message)
        Specified by:
        logDebug in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • logInfo

        public void logInfo​(String message)
        Specified by:
        logInfo in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • logWarning

        public void logWarning​(String message)
        Specified by:
        logWarning in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • logError

        public void logError​(String message)
        Specified by:
        logError in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • printHelp

        public void printHelp​(org.apache.commons.cli.Options options,
                              String name)
        Specified by:
        printHelp in interface org.dspace.scripts.handler.DSpaceRunnableHandler
      • getFileStream

        public Optional<InputStream> getFileStream​(org.dspace.core.Context context,
                                                   String fileName)
                                            throws IOException,
                                                   org.dspace.authorize.AuthorizeException
        Specified by:
        getFileStream in interface org.dspace.scripts.handler.DSpaceRunnableHandler
        Throws:
        IOException
        org.dspace.authorize.AuthorizeException
      • writeFilestream

        public void writeFilestream​(org.dspace.core.Context context,
                                    String fileName,
                                    InputStream inputStream,
                                    String type)
                             throws IOException,
                                    SQLException,
                                    org.dspace.authorize.AuthorizeException
        Specified by:
        writeFilestream in interface org.dspace.scripts.handler.DSpaceRunnableHandler
        Throws:
        IOException
        SQLException
        org.dspace.authorize.AuthorizeException
      • getProcess

        public org.dspace.scripts.Process getProcess​(org.dspace.core.Context context)
        This method will return the process created by this handler
        Parameters:
        context -
        Returns:
        The Process database object created by this handler
      • schedule

        public void schedule​(org.dspace.scripts.DSpaceRunnable script)
        This method will schedule a process to be run, it will trigger the run method for the Script passed along to this method as well as updating the database logic for the Process representing the execution of this script
        Parameters:
        script - The script to be ran