Class RestDSpaceRunnableHandler
- java.lang.Object
-
- org.dspace.app.rest.scripts.handler.impl.RestDSpaceRunnableHandler
-
- All Implemented Interfaces:
org.dspace.scripts.handler.DSpaceRunnableHandler
public class RestDSpaceRunnableHandler extends Object implements org.dspace.scripts.handler.DSpaceRunnableHandler
TheDSpaceRunnableHandlerdealing with Scripts started from the REST api
-
-
Constructor Summary
Constructors Constructor Description RestDSpaceRunnableHandler(org.dspace.eperson.EPerson ePerson, String scriptName, List<org.dspace.scripts.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(org.dspace.core.Context context, String fileName)org.dspace.scripts.ProcessgetProcess(org.dspace.core.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)voidlogInfo(String message)voidlogWarning(String message)voidprintHelp(org.apache.commons.cli.Options options, String name)voidschedule(org.dspace.scripts.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(org.dspace.core.Context context, String fileName, InputStream inputStream, String type)
-
-
-
Constructor Detail
-
RestDSpaceRunnableHandler
public RestDSpaceRunnableHandler(org.dspace.eperson.EPerson ePerson, String scriptName, List<org.dspace.scripts.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 interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
handleCompletion
public void handleCompletion()
- Specified by:
handleCompletionin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
handleException
public void handleException(Exception e)
- Specified by:
handleExceptionin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
handleException
public void handleException(String message)
- Specified by:
handleExceptionin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
handleException
public void handleException(String message, Exception e)
- Specified by:
handleExceptionin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
logDebug
public void logDebug(String message)
- Specified by:
logDebugin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
logInfo
public void logInfo(String message)
- Specified by:
logInfoin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
logWarning
public void logWarning(String message)
- Specified by:
logWarningin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
logError
public void logError(String message)
- Specified by:
logErrorin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
printHelp
public void printHelp(org.apache.commons.cli.Options options, String name)- Specified by:
printHelpin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler
-
getFileStream
public Optional<InputStream> getFileStream(org.dspace.core.Context context, String fileName) throws IOException, org.dspace.authorize.AuthorizeException
- Specified by:
getFileStreamin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler- Throws:
IOExceptionorg.dspace.authorize.AuthorizeException
-
writeFilestream
public void writeFilestream(org.dspace.core.Context context, String fileName, InputStream inputStream, String type) throws IOException, SQLException, org.dspace.authorize.AuthorizeException- Specified by:
writeFilestreamin interfaceorg.dspace.scripts.handler.DSpaceRunnableHandler- Throws:
IOExceptionSQLExceptionorg.dspace.authorize.AuthorizeException
-
getProcess
public org.dspace.scripts.Process getProcess(org.dspace.core.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(org.dspace.scripts.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
-
-