Class RestDSpaceRunnableHandler
- java.lang.Object
-
- org.dspace.app.rest.scripts.handler.impl.RestDSpaceRunnableHandler
-
- All Implemented Interfaces:
DSpaceRunnableHandler
public class RestDSpaceRunnableHandler extends Object implements DSpaceRunnableHandler
TheDSpaceRunnableHandlerdealing with Scripts started from the REST api
-
-
Constructor Summary
Constructors Constructor Description RestDSpaceRunnableHandler(EPerson ePerson, String scriptName, List<DSpaceCommandLineParameter> parameters)This constructor will initialise the handler with the process created from the parameters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<InputStream>getFileStream(Context context, String fileName)ProcessgetProcess(Context context)This method will return the process created by this handlervoidhandleCompletion()voidhandleException(Exception e)voidhandleException(String message)voidhandleException(String message, Exception e)voidlogDebug(String message)voidlogError(String message)voidlogError(String message, Throwable throwable)voidlogInfo(String message)voidlogWarning(String message)voidprintHelp(org.apache.commons.cli.Options options, String name)voidschedule(DSpaceRunnable script)This method will schedule a process to be run, it will trigger the run method for the Script passed along to this method as well as updating the database logic for the Process representing the execution of this scriptvoidstart()voidwriteFilestream(Context context, String fileName, InputStream inputStream, String type)
-
-
-
Constructor Detail
-
RestDSpaceRunnableHandler
public RestDSpaceRunnableHandler(EPerson ePerson, String scriptName, List<DSpaceCommandLineParameter> parameters)
This constructor will initialise the handler with the process created from the parameters- Parameters:
ePerson- The eperson that creates the processscriptName- The name of the script for which is a process will be createdparameters- The parameters for this process
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceDSpaceRunnableHandler
-
handleCompletion
public void handleCompletion()
- Specified by:
handleCompletionin interfaceDSpaceRunnableHandler
-
handleException
public void handleException(Exception e)
- Specified by:
handleExceptionin interfaceDSpaceRunnableHandler
-
handleException
public void handleException(String message)
- Specified by:
handleExceptionin interfaceDSpaceRunnableHandler
-
handleException
public void handleException(String message, Exception e)
- Specified by:
handleExceptionin interfaceDSpaceRunnableHandler
-
logDebug
public void logDebug(String message)
- Specified by:
logDebugin interfaceDSpaceRunnableHandler
-
logInfo
public void logInfo(String message)
- Specified by:
logInfoin interfaceDSpaceRunnableHandler
-
logWarning
public void logWarning(String message)
- Specified by:
logWarningin interfaceDSpaceRunnableHandler
-
logError
public void logError(String message)
- Specified by:
logErrorin interfaceDSpaceRunnableHandler
-
logError
public void logError(String message, Throwable throwable)
- Specified by:
logErrorin interfaceDSpaceRunnableHandler
-
printHelp
public void printHelp(org.apache.commons.cli.Options options, String name)- Specified by:
printHelpin interfaceDSpaceRunnableHandler
-
getFileStream
public Optional<InputStream> getFileStream(Context context, String fileName) throws IOException, AuthorizeException
- Specified by:
getFileStreamin interfaceDSpaceRunnableHandler- Throws:
IOExceptionAuthorizeException
-
writeFilestream
public void writeFilestream(Context context, String fileName, InputStream inputStream, String type) throws IOException, SQLException, AuthorizeException
- Specified by:
writeFilestreamin interfaceDSpaceRunnableHandler- Throws:
IOExceptionSQLExceptionAuthorizeException
-
getProcess
public Process getProcess(Context context)
This method will return the process created by this handler- Parameters:
context-- Returns:
- The Process database object created by this handler
-
schedule
public void schedule(DSpaceRunnable script)
This method will schedule a process to be run, it will trigger the run method for the Script passed along to this method as well as updating the database logic for the Process representing the execution of this script- Parameters:
script- The script to be ran
-
-