Package org.dspace.scripts.handler
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
Modifier and TypeMethodDescriptiongetFileStream(Context context, String fileName) This method will grab the InputStream for the file defined by the given file name.This method will return a List of UUIDs for the special groups associated with the processId contained by specific implementations of this interface.voidThis method handles the completion of the scriptvoidThis method handles an exception thrown by the scriptvoidhandleException(String message) This method handles an exception thrown by the scriptvoidhandleException(String message, Exception e) This method handles an exception thrown by the scriptvoidThis method will perform the debug logging of the message givenvoidThis method will perform the error logging of the message givenvoidThis method will perform the error logging of the message given along with a stack tracevoidThis method will perform the info logging of the message givenvoidlogWarning(String message) This method will perform the warning logging of the message givenvoidThis method will print the help for the options and namevoidstart()This method handles the start of the scriptvoidwriteFilestream(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 Details
-
start
This method handles the start of the script- Throws:
SQLException- If something goes wrong
-
handleCompletion
This method handles the completion of the script- Throws:
SQLException- If something goes wrong
-
handleException
This method handles an exception thrown by the script- Parameters:
e- The exception thrown by the script
-
handleException
This method handles an exception thrown by the script- Parameters:
message- The String message for the exception thrown by the script
-
handleException
This method handles an exception thrown by the script- Parameters:
message- The String message for the exception thrown by the scripte- The exception thrown by the script
-
logDebug
This method will perform the debug logging of the message given- Parameters:
message- The message to be logged as debug
-
logInfo
This method will perform the info logging of the message given- Parameters:
message- The message to be logged as info
-
logWarning
This method will perform the warning logging of the message given- Parameters:
message- The message to be logged as warning
-
logError
This method will perform the error logging of the message given- Parameters:
message- The message to be logged as an error
-
logError
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 errorthrowable- The original exception
-
printHelp
This method will print the help for the options and name- Parameters:
options- The options for the scriptname- 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 contextfileName- 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 wrongAuthorizeException- 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 contextfileName- The filenameinputStream- The inputstream to be writtentype- The type of the file- Throws:
IOException- If something goes wrongSQLExceptionAuthorizeException
-
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.
-