Package org.dspace.scripts.handler.impl
Class CommandLineDSpaceRunnableHandler
- java.lang.Object
-
- org.dspace.scripts.handler.impl.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 Summary
Constructors Constructor Description CommandLineDSpaceRunnableHandler()
-
Method Summary
All Methods Instance Methods Concrete 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.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
public void start()
Description copied from interface:DSpaceRunnableHandlerThis method handles the start of the script- Specified by:
startin interfaceDSpaceRunnableHandler
-
handleCompletion
public void handleCompletion()
Description copied from interface:DSpaceRunnableHandlerThis method handles the completion of the script- Specified by:
handleCompletionin interfaceDSpaceRunnableHandler
-
handleException
public void handleException(Exception e)
Description copied from interface:DSpaceRunnableHandlerThis method handles an exception thrown by the script- Specified by:
handleExceptionin interfaceDSpaceRunnableHandler- Parameters:
e- The exception thrown by the script
-
handleException
public void handleException(String message)
Description copied from interface:DSpaceRunnableHandlerThis method handles an exception thrown by the script- Specified by:
handleExceptionin interfaceDSpaceRunnableHandler- Parameters:
message- The String message for the exception thrown by the script
-
handleException
public void handleException(String message, Exception e)
Description copied from interface:DSpaceRunnableHandlerThis method handles an exception thrown by the script- Specified by:
handleExceptionin interfaceDSpaceRunnableHandler- Parameters:
message- The String message for the exception thrown by the scripte- The exception thrown by the script
-
logDebug
public void logDebug(String message)
Description copied from interface:DSpaceRunnableHandlerThis method will perform the debug logging of the message given- Specified by:
logDebugin interfaceDSpaceRunnableHandler- Parameters:
message- The message to be logged as debug
-
logInfo
public void logInfo(String message)
Description copied from interface:DSpaceRunnableHandlerThis method will perform the info logging of the message given- Specified by:
logInfoin interfaceDSpaceRunnableHandler- Parameters:
message- The message to be logged as info
-
logWarning
public void logWarning(String message)
Description copied from interface:DSpaceRunnableHandlerThis method will perform the warning logging of the message given- Specified by:
logWarningin interfaceDSpaceRunnableHandler- Parameters:
message- The message to be logged as warning
-
logError
public void logError(String message)
Description copied from interface:DSpaceRunnableHandlerThis method will perform the error logging of the message given- Specified by:
logErrorin interfaceDSpaceRunnableHandler- Parameters:
message- The message to be logged as an error
-
logError
public void logError(String message, Throwable throwable)
Description copied from interface:DSpaceRunnableHandlerThis method will perform the error logging of the message given along with a stack trace- Specified by:
logErrorin interfaceDSpaceRunnableHandler- Parameters:
message- The message to be logged as an errorthrowable- The original exception
-
printHelp
public void printHelp(org.apache.commons.cli.Options options, String name)Description copied from interface:DSpaceRunnableHandlerThis method will print the help for the options and name- Specified by:
printHelpin interfaceDSpaceRunnableHandler- Parameters:
options- The options for the scriptname- The name of the script
-
getFileStream
public Optional<InputStream> getFileStream(Context context, String fileName) throws IOException
Description copied from interface:DSpaceRunnableHandlerThis 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:
getFileStreamin interfaceDSpaceRunnableHandler- 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 wrong
-
writeFilestream
public void writeFilestream(Context context, String fileName, InputStream inputStream, String type) throws IOException
Description copied from interface:DSpaceRunnableHandlerThis 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:
writeFilestreamin interfaceDSpaceRunnableHandler- Parameters:
context- The relevant DSpace contextfileName- The filenameinputStream- The inputstream to be writtentype- The type of the file- Throws:
IOException- If something goes wrong
-
-