public class BaseFileCopier
extends java.lang.Object
| 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 |
|---|
BaseFileCopier() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
appendRemoteFileExtension(java.lang.String filepath,
java.lang.String fileext) |
static java.lang.String |
defaultRemoteFileExtensionForNode(INodeEntry node) |
static 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)
|
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 |
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)
|
static java.lang.String |
generateRemoteFilepathForNode(INodeEntry node,
java.lang.String scriptfileName,
java.lang.String fileExtension,
java.lang.String identity)
|
static java.lang.String |
getRemoteDirForNode(INodeEntry node)
Return a remote destination temp dir path for the given node.
|
static java.lang.String |
getRemoteDirForNode(INodeEntry node,
IRundeckProject project,
IFramework framework)
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 |
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 static java.lang.String defaultRemoteFileExtensionForNode(INodeEntry node)
node - nodepublic static java.lang.String appendRemoteFileExtension(java.lang.String filepath,
java.lang.String fileext)
filepath - 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 static java.lang.String getRemoteDirForNode(INodeEntry node)
node - the node entrypublic static java.lang.String getRemoteDirForNode(INodeEntry node, IRundeckProject project, IFramework framework)
node - the node entryproject - projectframework - frameworkpublic static java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName)
node - the destination nodescriptfileName - the name of the file to copypublic static java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName, java.lang.String fileExtension)
node - the destination nodescriptfileName - the name of the file to copyfileExtension - optional extension to use for the temp file, or null for defaultpublic static java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName, java.lang.String fileExtension, java.lang.String identity)
node - 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 static java.lang.String generateRemoteFilepathForNode(INodeEntry node, IRundeckProject project, IFramework framework, java.lang.String scriptfileName, java.lang.String fileExtension, java.lang.String identity)
node - 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 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 nullScriptfileUtils.releaseTempFile(java.io.File)FileCopierException - 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
original - source fileinput - source streamscript - source stringdestinationFile - destinationFileCopierException - on error