Class DSpaceRunnable<T extends ScriptConfiguration>

    • Field Detail

      • commandLine

        protected org.apache.commons.cli.CommandLine commandLine
        The CommandLine object for the script that'll hold the information
      • handler

        protected DSpaceRunnableHandler handler
        The handler that deals with this script. This handler can currently either be a RestDSpaceRunnableHandler or a CommandlineDSpaceRunnableHandler depending from where the script is called
    • Constructor Detail

      • DSpaceRunnable

        public DSpaceRunnable()
    • Method Detail

      • getScriptConfiguration

        public abstract T getScriptConfiguration()
        This method will return the Configuration that the implementing DSpaceRunnable uses
        Returns:
        The ScriptConfiguration that this implementing DspaceRunnable uses
      • initialize

        public void initialize​(String[] args,
                               DSpaceRunnableHandler dSpaceRunnableHandler,
                               EPerson currentUser)
                        throws org.apache.commons.cli.ParseException
        This method sets the appropriate DSpaceRunnableHandler depending on where it was ran from and it parses the arguments given to the script
        Parameters:
        args - The arguments given to the script
        dSpaceRunnableHandler - The DSpaceRunnableHandler object that defines from where the script was ran
        currentUser -
        Throws:
        org.apache.commons.cli.ParseException - If something goes wrong
      • setup

        public abstract void setup()
                            throws org.apache.commons.cli.ParseException
        This method has to be included in every script and handles the setup of the script by parsing the CommandLine and setting the variables
        Throws:
        org.apache.commons.cli.ParseException - If something goes wrong
      • run

        public void run()
        This is the run() method from the Runnable interface that we implement. This method will handle the running of the script and all the database modifications needed for the Process object that resulted from this script
        Specified by:
        run in interface Runnable
      • internalRun

        public abstract void internalRun()
                                  throws Exception
        This method has to be included in every script and this will be the main execution block for the script that'll contain all the logic needed
        Throws:
        Exception - If something goes wrong
      • getFileNamesFromInputStreamOptions

        public List<String> getFileNamesFromInputStreamOptions()
        This method will traverse all the options and it'll grab options defined as an InputStream type to then save the filename specified by that option in a list of Strings that'll be returned in the end
        Returns:
        The list of Strings representing filenames from the options given to the script
      • getEpersonIdentifier

        public UUID getEpersonIdentifier()
        Generic getter for the epersonIdentifier This EPerson identifier variable is the uuid of the eperson that's running the script
        Returns:
        the epersonIdentifier value of this DSpaceRunnable
      • setEpersonIdentifier

        public void setEpersonIdentifier​(UUID epersonIdentifier)
        Generic setter for the epersonIdentifier. This EPerson identifier variable is the UUID of the EPerson that's running the script.
        Parameters:
        epersonIdentifier - The epersonIdentifier to be set on this DSpaceRunnable