public class BaseFileCopier
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FILE_COPY_DESTINATION_DIR |
Constructor and Description |
---|
BaseFileCopier() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
appendRemoteFileExtensionForNode(INodeEntry node,
java.lang.String filepath)
Return a string with an appropriate script file extension appended if it is not already on the file path
provided.
|
static java.lang.String |
generateRemoteFilepathForNode(INodeEntry node,
java.lang.String scriptfileName)
Return a temporary filepath for a file to be copied to the node, given the input filename (without directory
path)
|
static java.lang.String |
getRemoteDirForNode(INodeEntry node)
Return a remote destination temp dir path for the given node.
|
protected static java.io.File |
writeLocalFile(java.io.File original,
java.io.InputStream input,
java.lang.String script,
java.io.File destinationFile) |
static java.io.File |
writeScriptTempFile(ExecutionContext context,
java.io.File original,
java.io.InputStream input,
java.lang.String script,
INodeEntry node)
Copy a script file, script source stream, or script string into a temp file, and replace \
embedded tokens with values from the dataContext for the latter two.
|
static java.io.File |
writeTempFile(ExecutionContext context,
java.io.File original,
java.io.InputStream input,
java.lang.String script)
Write the file, stream, or text to a local temp file and return the file
|
public static final java.lang.String FILE_COPY_DESTINATION_DIR
public static java.io.File writeScriptTempFile(ExecutionContext context, java.io.File original, java.io.InputStream input, java.lang.String script, INodeEntry node) throws FileCopierException
context
- execution contextoriginal
- local system file, or nullinput
- input stream to write, or nullscript
- file content string, or nullnode
- destination node entry, to provide node data contextExecutionException
- if an IO problem occursFileCopierException
public static java.lang.String appendRemoteFileExtensionForNode(INodeEntry node, java.lang.String filepath)
node
- node destinationfilepath
- the file path stringpublic static java.lang.String getRemoteDirForNode(INodeEntry node)
node
- the node entrypublic static java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName)
node
- the destination nodescriptfileName
- the name of the file to copypublic static java.io.File writeTempFile(ExecutionContext context, java.io.File original, java.io.InputStream input, java.lang.String script) throws FileCopierException
context
- contextoriginal
- source file, or nullinput
- source inputstream or nullscript
- source text, or nullFileCopierException
- if IOException occursprotected static java.io.File writeLocalFile(java.io.File original, java.io.InputStream input, java.lang.String script, java.io.File destinationFile) throws FileCopierException
FileCopierException