Interface DSpaceRunnableHandler

  • All Known Implementing Classes:
    CommandLineDSpaceRunnableHandler

    public interface DSpaceRunnableHandler
    This is an interface meant to be implemented by any DSpaceRunnableHandler to specify specific execution methods of the script depending on where it was called from
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Optional<InputStream> getFileStream​(Context context, String fileName)
      This method will grab the InputStream for the file defined by the given file name.
      List<UUID> getSpecialGroups()
      This method will return a List of UUIDs for the special groups associated with the processId contained by specific implementations of this interface.
      void handleCompletion()
      This method handles the completion of the script
      void handleException​(Exception e)
      This method handles an exception thrown by the script
      void handleException​(String message)
      This method handles an exception thrown by the script
      void handleException​(String message, Exception e)
      This method handles an exception thrown by the script
      void logDebug​(String message)
      This method will perform the debug logging of the message given
      void logError​(String message)
      This method will perform the error logging of the message given
      void logError​(String message, Throwable throwable)
      This method will perform the error logging of the message given along with a stack trace
      void logInfo​(String message)
      This method will perform the info logging of the message given
      void logWarning​(String message)
      This method will perform the warning logging of the message given
      void printHelp​(org.apache.commons.cli.Options options, String name)
      This method will print the help for the options and name
      void start()
      This method handles the start of the script
      void writeFilestream​(Context context, String fileName, InputStream inputStream, String type)
      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
    • Method Detail

      • start

        void start()
            throws SQLException
        This method handles the start of the script
        Throws:
        SQLException - If something goes wrong
      • handleCompletion

        void handleCompletion()
                       throws SQLException
        This method handles the completion of the script
        Throws:
        SQLException - If something goes wrong
      • handleException

        void handleException​(Exception e)
        This method handles an exception thrown by the script
        Parameters:
        e - The exception thrown by the script
      • handleException

        void handleException​(String message)
        This method handles an exception thrown by the script
        Parameters:
        message - The String message for the exception thrown by the script
      • handleException

        void handleException​(String message,
                             Exception e)
        This method handles an exception thrown by the script
        Parameters:
        message - The String message for the exception thrown by the script
        e - The exception thrown by the script
      • logDebug

        void logDebug​(String message)
        This method will perform the debug logging of the message given
        Parameters:
        message - The message to be logged as debug
      • logInfo

        void logInfo​(String message)
        This method will perform the info logging of the message given
        Parameters:
        message - The message to be logged as info
      • logWarning

        void logWarning​(String message)
        This method will perform the warning logging of the message given
        Parameters:
        message - The message to be logged as warning
      • logError

        void logError​(String message)
        This method will perform the error logging of the message given
        Parameters:
        message - The message to be logged as an error
      • logError

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

        void printHelp​(org.apache.commons.cli.Options options,
                       String name)
        This method will print the help for the options and name
        Parameters:
        options - The options for the script
        name - The name of the script
      • getFileStream

        Optional<InputStream> getFileStream​(Context context,
                                            String fileName)
                                     throws IOException,
                                            AuthorizeException
        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
        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
        AuthorizeException - If something goes wrong
      • writeFilestream

        void writeFilestream​(Context context,
                             String fileName,
                             InputStream inputStream,
                             String type)
                      throws IOException,
                             SQLException,
                             AuthorizeException
        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
        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
        SQLException
        AuthorizeException
      • getSpecialGroups

        List<UUID> getSpecialGroups()
        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.
        Returns:
        List containing UUIDs of Special Groups of the associated Process.