|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dtolabs.rundeck.core.execution.impl.common.BaseFileCopier
public class BaseFileCopier
BaseFileCopier provides utility methods for a FileCopier class.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_UNIX_FILE_EXT
|
static java.lang.String |
DEFAULT_WINDOWS_FILE_EXT
|
static java.lang.String |
FILE_COPY_DESTINATION_DIR
|
Constructor Summary | |
---|---|
BaseFileCopier()
|
Method Summary | |
---|---|
static java.lang.String |
appendRemoteFileExtension(java.lang.String filepath,
java.lang.String fileext)
Return a string with a file extension appended if it is not already on the file path provided. |
static java.lang.String |
defaultRemoteFileExtensionForNode(INodeEntry node)
Return the default file extension for a temp file based on the type of node |
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 |
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 |
writeScriptTempFile(ExecutionContext context,
java.io.File original,
java.io.InputStream input,
java.lang.String script,
INodeEntry node,
java.io.File destination)
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String FILE_COPY_DESTINATION_DIR
public static final java.lang.String DEFAULT_WINDOWS_FILE_EXT
public static final java.lang.String DEFAULT_UNIX_FILE_EXT
Constructor Detail |
---|
public BaseFileCopier()
Method Detail |
---|
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 context
ExecutionException
- if an IO problem occurs
FileCopierException
public static java.io.File writeScriptTempFile(ExecutionContext context, java.io.File original, java.io.InputStream input, java.lang.String script, INodeEntry node, java.io.File destination) 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 contextdestination
- destination file, or null to generate a new temp file
ExecutionException
- if an IO problem occurs
FileCopierException
public static java.lang.String defaultRemoteFileExtensionForNode(INodeEntry node)
node
-
public 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 entry
public static java.lang.String generateRemoteFilepathForNode(INodeEntry node, java.lang.String scriptfileName)
node
- the destination nodescriptfileName
- the name of the file to copy
public 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 default
public 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 null
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
- input
- script
- destinationFile
-
FileCopierException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |