public interface HandlerIO extends VitamAutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
addInIOParameters(List<IOParameter> list)
Add Input parameters
|
HandlerIO |
addOuputResult(int rank,
Object object,
boolean asyncIO)
Add one output result (no delete)
|
HandlerIO |
addOuputResult(int rank,
Object object,
boolean deleteLocal,
boolean asyncIO)
Add one output result
|
void |
addOutIOParameters(List<IOParameter> list)
Add Output parameters
|
boolean |
checkHandlerIO(int outputNumber,
List<Class<?>> clasz)
Check if input and output have the very same number of elements and for Input the associated types
|
void |
consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
Consume any entity and close response
|
boolean |
deleteLocalFile(String objectName)
Helper to delete a local file
To be used when not specified within the Input/Output parameters |
void |
enableAsync(boolean asyncIo)
If true then start async manager, if false then waitEndOfTransfer and stop asyncManager
|
String |
getContainerName() |
File |
getFileFromWorkspace(String objectName)
Helper to load a file from Workspace (or local cache) and save it into local cache.
To be used when not specified within the Input parameters |
LogbookLifeCyclesClientHelper |
getHelper() |
List<Object> |
getInput() |
Object |
getInput(int rank)
Return one Object from input
|
InputStream |
getInputStreamFromWorkspace(String objectName)
Helper to get an InputStream (using local cache if possible) from Workspace
To be used when not specified within the Input parameters |
javax.ws.rs.core.Response |
getInputStreamNoCachedFromWorkspace(String objectName)
Helper to get an InputStream (without cache) from Workspace
To be used when not specified within the Input parameters |
com.fasterxml.jackson.databind.JsonNode |
getJsonFromWorkspace(String jsonFilePath)
Retrieve a json file as a
JsonNode from the workspace. |
LogbookLifeCyclesClient |
getLifecyclesClient() |
File |
getLocalPathRoot() |
File |
getNewLocalFile(String name) |
List<ProcessingUri> |
getOutput() |
ProcessingUri |
getOutput(int rank)
Return one ProcessingUri from output
|
List<URI> |
getUriList(String containerName,
String folderName) |
String |
getWorkerId() |
boolean |
removeFolder(String folderName)
Remove a specific folder
|
void |
reset()
Reset after each Action
|
void |
transferFileToWorkspace(String workspacePath,
File sourceFile,
boolean toDelete,
boolean asyncIO)
Helper to write a file to Workspace
To be used when not specified within the Output Parameters |
void |
transferInputStreamToWorkspace(String workspacePath,
InputStream inputStream,
Path filePath,
boolean asyncIO)
Helper to write an InputStream to Workspace
To be used when not specified within the Output Parameters |
void |
transferJsonToWorkspace(String collectionName,
String workspacePath,
com.fasterxml.jackson.databind.JsonNode jsonNode,
boolean toDelete,
boolean asyncIO)
Helper to convert and write a file to Workspace
|
void |
unzipInputStreamOnWorkspace(String container,
String folderName,
String archiveMimeType,
InputStream uploadedInputStream,
boolean asyncIO) |
void |
zipWorkspace(String output,
String... inputFiles)
compress list of file or directory in a specific output file
|
close
void addInIOParameters(List<IOParameter> list)
list
- IllegalArgumentException
- if an error occursvoid addOutIOParameters(List<IOParameter> list)
list
- IllegalArgumentException
- if an error occursvoid reset()
Object getInput(int rank)
rank
- List<ProcessingUri> getOutput()
ProcessingUri getOutput(int rank)
rank
- HandlerIO addOuputResult(int rank, Object object, boolean asyncIO) throws ProcessingException
rank
- the position in the outputobject
- the result to store (WORKSPACE to workspace and must be a File, MEMORY to memory whatever it is)asyncIO
- asynchronously send to the workspaceProcessingException
IllegalArgumentException
HandlerIO addOuputResult(int rank, Object object, boolean deleteLocal, boolean asyncIO) throws ProcessingException
rank
- the position in the outputobject
- the result to store (WORKSPACE to workspace and must be a File, MEMORY to memory whatever it is)deleteLocal
- if true, will delete the local file in case of WORKSPACE onlyasyncIO
- asynchronously send to the workspaceProcessingException
IllegalArgumentException
String getContainerName()
String getWorkerId()
File getLocalPathRoot()
File getNewLocalFile(String name)
name
- List<URI> getUriList(String containerName, String folderName) throws ProcessingException
containerName
- folderName
- ProcessingException
boolean checkHandlerIO(int outputNumber, List<Class<?>> clasz)
outputNumber
- the number of outputArgumentsclasz
- the list of Class that should be in the InputParametersvoid transferFileToWorkspace(String workspacePath, File sourceFile, boolean toDelete, boolean asyncIO) throws ProcessingException
workspacePath
- path within the workspath, without the container (implicit)sourceFile
- the source file to writetoDelete
- if True, will delete the local fileasyncIO
- asynchronously send to the workspaceProcessingException
void transferInputStreamToWorkspace(String workspacePath, InputStream inputStream, Path filePath, boolean asyncIO) throws ProcessingException
workspacePath
- path within the workspath, without the container (implicit)inputStream
- the source InputStream to writeasyncIO
- asynchronously send to the workspaceProcessingException
File getFileFromWorkspace(String objectName) throws IOException, ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
objectName
- IOException
ContentAddressableStorageNotFoundException
ContentAddressableStorageServerException
InputStream getInputStreamFromWorkspace(String objectName) throws IOException, ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
objectName
- IOException
ContentAddressableStorageNotFoundException
ContentAddressableStorageServerException
javax.ws.rs.core.Response getInputStreamNoCachedFromWorkspace(String objectName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
objectName
- ContentAddressableStorageNotFoundException
ContentAddressableStorageServerException
void consumeAnyEntityAndClose(javax.ws.rs.core.Response response)
response
- com.fasterxml.jackson.databind.JsonNode getJsonFromWorkspace(String jsonFilePath) throws ProcessingException
JsonNode
from the workspace.jsonFilePath
- path in workspace of the json FileProcessingException
- throws when error occursboolean deleteLocalFile(String objectName)
objectName
- LogbookLifeCyclesClient getLifecyclesClient()
LogbookLifeCyclesClientHelper getHelper()
void transferJsonToWorkspace(String collectionName, String workspacePath, com.fasterxml.jackson.databind.JsonNode jsonNode, boolean toDelete, boolean asyncIO) throws ProcessingException
collectionName
- : collection typeworkspacePath
- path within the workspacepath, without the container (implicit)jsonNode
- the json file to writetoDelete
- if True, will delete the local fileasyncIO
- asynchronously send to the workspaceProcessingException
void unzipInputStreamOnWorkspace(String container, String folderName, String archiveMimeType, InputStream uploadedInputStream, boolean asyncIO) throws ContentAddressableStorageException
container
- folderName
- archiveMimeType
- uploadedInputStream
- asyncIO
- asynchronously send and unzip file to/in the workspaceContentAddressableStorageException
void zipWorkspace(String output, String... inputFiles) throws ContentAddressableStorageException
output
- path of the zip fileinputFiles
- list of file or directory to zipContentAddressableStorageException
void enableAsync(boolean asyncIo) throws WorkerspaceQueueException
asyncIo
- WorkerspaceQueueException
boolean removeFolder(String folderName) throws ContentAddressableStorageException
folderName
- the folderName to deleteContentAddressableStorageException
- when storage error occursCopyright © 2018 Vitam. All rights reserved.