Package org.dspace.scripts.handler
Interface DSpaceRunnableHandler
-
- All Known Implementing Classes:
CommandLineDSpaceRunnableHandler
public interface DSpaceRunnableHandlerThis 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.voidhandleCompletion()This method handles the completion of the scriptvoidhandleException(Exception e)This 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 scriptvoidlogDebug(String message)This method will perform the debug logging of the message givenvoidlogError(String message)This method will perform the error logging of the message givenvoidlogError(String message, Throwable throwable)This method will perform the error logging of the message given along with a stack tracevoidlogInfo(String message)This method will perform the info logging of the message givenvoidlogWarning(String message)This method will perform the warning logging of the message givenvoidprintHelp(org.apache.commons.cli.Options options, String name)This 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 Detail
-
start
void start() throws SQLExceptionThis method handles the start of the script- Throws:
SQLException- If something goes wrong
-
handleCompletion
void handleCompletion() throws SQLExceptionThis 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 scripte- 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 errorthrowable- 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 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
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.
-
-