public class DefaultFileCopierUtil extends java.lang.Object implements FileCopierUtil
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_UNIX_FILE_EXT |
static java.lang.String |
DEFAULT_WINDOWS_FILE_EXT |
static java.lang.String |
FILE_COPY_DESTINATION_DIR |
static java.lang.String |
FRAMEWORK_FILE_COPY_DESTINATION_DIR |
static java.lang.String |
PROJECT_FILE_COPY_DESTINATION_DIR |
| Constructor and Description |
|---|
DefaultFileCopierUtil() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
appendRemoteFileExtension(java.lang.String filepath,
java.lang.String fileext) |
java.lang.String |
defaultRemoteFileExtensionForNode(INodeEntry node) |
java.lang.String |
generateRemoteFilepathForNode(INodeEntry node,
IRundeckProject project,
IFramework framework,
java.lang.String scriptfileName,
java.lang.String fileExtension,
java.lang.String identity)
Return a temporary filepath for a file to be copied to the node, given the input filename (without directory
path)
|
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)
|
java.lang.String |
generateRemoteFilepathForNode(INodeEntry node,
java.lang.String scriptfileName,
java.lang.String fileExtension)
Return a temporary filepath for a file to be copied to the node, given the input filename (without directory
path)
|
java.lang.String |
generateRemoteFilepathForNode(INodeEntry node,
java.lang.String scriptfileName,
java.lang.String fileExtension,
java.lang.String identity)
|
java.lang.String |
getRemoteDirForNode(INodeEntry node)
Return a remote destination temp dir path for the given node.
|
java.lang.String |
getRemoteDirForNode(INodeEntry node,
IRundeckProject project,
IFramework framework)
Return a remote destination temp dir path for the given node.
|
java.io.File |
writeLocalFile(java.io.File original,
java.io.InputStream input,
java.lang.String script,
java.io.File destinationFile) |
java.io.File |
writeScriptTempFile(ExecutionContext context,
java.io.File original,
java.io.InputStream input,
java.lang.String script,
INodeEntry node,
boolean expandTokens)
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.
|
java.io.File |
writeScriptTempFile(ExecutionContext context,
java.io.File original,
java.io.InputStream input,
java.lang.String script,
INodeEntry node,
java.io.File destination,
boolean expandTokens)
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.
|
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 final java.lang.String FRAMEWORK_FILE_COPY_DESTINATION_DIR
public static final java.lang.String PROJECT_FILE_COPY_DESTINATION_DIR
public static final java.lang.String DEFAULT_WINDOWS_FILE_EXT
public static final java.lang.String DEFAULT_UNIX_FILE_EXT
public java.io.File writeScriptTempFile(ExecutionContext context, java.io.File original, java.io.InputStream input, java.lang.String script, INodeEntry node, boolean expandTokens) throws FileCopierException
writeScriptTempFile in interface FileCopierUtilcontext - 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 contextexpandTokens - if true, expand tokens in the stream or stringScriptfileUtils.releaseTempFile(java.io.File)FileCopierException - if an IO problem occurspublic java.io.File writeScriptTempFile(ExecutionContext context, java.io.File original, java.io.InputStream input, java.lang.String script, INodeEntry node, java.io.File destination, boolean expandTokens) throws FileCopierException
writeScriptTempFile in interface FileCopierUtilcontext - 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 contextdestination - destination file, or null to generate a new temp fileexpandTokens - if true, expand tokens in the stream or stringFileCopierException - if an IO problem occurspublic java.lang.String defaultRemoteFileExtensionForNode(INodeEntry node)
defaultRemoteFileExtensionForNode in interface FileCopierUtilnode - nodepublic java.lang.String appendRemoteFileExtension(java.lang.String filepath,
java.lang.String fileext)
appendRemoteFileExtension in interface FileCopierUtilfilepath - the file path stringfileext - the file extension, if it does not start with a "." one will be prepended
first. If null, the unmodified filepath will be returned.public java.lang.String getRemoteDirForNode(INodeEntry node)
getRemoteDirForNode in interface FileCopierUtilnode - the node entrypublic java.lang.String getRemoteDirForNode(INodeEntry node, IRundeckProject project, IFramework framework)
getRemoteDirForNode in interface FileCopierUtilnode - the node entryproject - projectframework - frameworkpublic java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName)
generateRemoteFilepathForNode in interface FileCopierUtilnode - the destination nodescriptfileName - the name of the file to copypublic java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName, java.lang.String fileExtension)
generateRemoteFilepathForNode in interface FileCopierUtilnode - the destination nodescriptfileName - the name of the file to copyfileExtension - optional extension to use for the temp file, or null for defaultpublic java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName, java.lang.String fileExtension, java.lang.String identity)
generateRemoteFilepathForNode in interface FileCopierUtilnode - the destination nodescriptfileName - the name of the file to copyfileExtension - optional extension to use for the temp file, or null for defaultidentity - unique identifier, or null to include a random stringpublic java.lang.String generateRemoteFilepathForNode(INodeEntry node, IRundeckProject project, IFramework framework, java.lang.String scriptfileName, java.lang.String fileExtension, java.lang.String identity)
generateRemoteFilepathForNode in interface FileCopierUtilnode - the destination nodeproject - projectframework - frameworkscriptfileName - the name of the file to copyfileExtension - optional extension to use for the temp file, or null for defaultidentity - unique identifier, or null to include a random stringpublic java.io.File writeTempFile(ExecutionContext context, java.io.File original, java.io.InputStream input, java.lang.String script) throws FileCopierException
writeTempFile in interface FileCopierUtilcontext - contextoriginal - source file, or nullinput - source inputstream or nullscript - source text, or nullScriptfileUtils.releaseTempFile(java.io.File)FileCopierException - if IOException occurspublic java.io.File writeLocalFile(java.io.File original,
java.io.InputStream input,
java.lang.String script,
java.io.File destinationFile)
throws FileCopierException
writeLocalFile in interface FileCopierUtiloriginal - source fileinput - source streamscript - source stringdestinationFile - destinationFileCopierException - on error