Class CommandLineDSpaceRunnableHandler

  • All Implemented Interfaces:
    DSpaceRunnableHandler

    public class CommandLineDSpaceRunnableHandler
    extends Object
    implements DSpaceRunnableHandler
    This is an implementation for the CommandLineDSpaceRunnables which means that these implementations are used by DSpaceRunnables which are called from the CommandLine
    • Constructor Detail

      • CommandLineDSpaceRunnableHandler

        public CommandLineDSpaceRunnableHandler()
    • Method Detail

      • handleException

        public void handleException​(String message)
        Description copied from interface: DSpaceRunnableHandler
        This method handles an exception thrown by the script
        Specified by:
        handleException in interface DSpaceRunnableHandler
        Parameters:
        message - The String message for the exception thrown by the script
      • handleException

        public void handleException​(String message,
                                    Exception e)
        Description copied from interface: DSpaceRunnableHandler
        This method handles an exception thrown by the script
        Specified by:
        handleException in interface DSpaceRunnableHandler
        Parameters:
        message - The String message for the exception thrown by the script
        e - The exception thrown by the script
      • logDebug

        public void logDebug​(String message)
        Description copied from interface: DSpaceRunnableHandler
        This method will perform the debug logging of the message given
        Specified by:
        logDebug in interface DSpaceRunnableHandler
        Parameters:
        message - The message to be logged as debug
      • logInfo

        public void logInfo​(String message)
        Description copied from interface: DSpaceRunnableHandler
        This method will perform the info logging of the message given
        Specified by:
        logInfo in interface DSpaceRunnableHandler
        Parameters:
        message - The message to be logged as info
      • logWarning

        public void logWarning​(String message)
        Description copied from interface: DSpaceRunnableHandler
        This method will perform the warning logging of the message given
        Specified by:
        logWarning in interface DSpaceRunnableHandler
        Parameters:
        message - The message to be logged as warning
      • logError

        public void logError​(String message)
        Description copied from interface: DSpaceRunnableHandler
        This method will perform the error logging of the message given
        Specified by:
        logError in interface DSpaceRunnableHandler
        Parameters:
        message - The message to be logged as an error
      • logError

        public void logError​(String message,
                             Throwable throwable)
        Description copied from interface: DSpaceRunnableHandler
        This method will perform the error logging of the message given along with a stack trace
        Specified by:
        logError in interface DSpaceRunnableHandler
        Parameters:
        message - The message to be logged as an error
        throwable - The original exception
      • printHelp

        public void printHelp​(org.apache.commons.cli.Options options,
                              String name)
        Description copied from interface: DSpaceRunnableHandler
        This method will print the help for the options and name
        Specified by:
        printHelp in interface DSpaceRunnableHandler
        Parameters:
        options - The options for the script
        name - The name of the script
      • getFileStream

        public Optional<InputStream> getFileStream​(Context context,
                                                   String fileName)
                                            throws IOException
        Description copied from interface: DSpaceRunnableHandler
        This method will grab the InputStream for the file defined by the given file name. The exact implementation will differ based on whether it's a REST call or CommandLine call. The REST Call will look for Bitstreams in the Database whereas the CommandLine call will look on the filesystem
        Specified by:
        getFileStream in interface DSpaceRunnableHandler
        Parameters:
        context - The relevant DSpace context
        fileName - The filename for the file that holds the InputStream
        Returns:
        The InputStream for the file defined by the given file name
        Throws:
        IOException - If something goes wrong
      • writeFilestream

        public void writeFilestream​(Context context,
                                    String fileName,
                                    InputStream inputStream,
                                    String type)
                             throws IOException
        Description copied from interface: DSpaceRunnableHandler
        This method will write the InputStream to either a file on the filesystem or a bitstream in the database depending on whether it's coming from a CommandLine call or REST call respectively
        Specified by:
        writeFilestream in interface DSpaceRunnableHandler
        Parameters:
        context - The relevant DSpace context
        fileName - The filename
        inputStream - The inputstream to be written
        type - The type of the file
        Throws:
        IOException - If something goes wrong
      • getSpecialGroups

        public List<UUID> getSpecialGroups()
        Description copied from interface: DSpaceRunnableHandler
        This method will return a List of UUIDs for the special groups associated with the processId contained by specific implementations of this interface. Otherwise, it returns an empty collection.
        Specified by:
        getSpecialGroups in interface DSpaceRunnableHandler
        Returns:
        List containing UUIDs of Special Groups of the associated Process.