public class ScriptEngine
extends java.lang.Object
Constructor and Description |
---|
ScriptEngine()
Default constructor
|
ScriptEngine(java.lang.String user,
java.lang.String password)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canConnect()
Can we connect with the current state?
|
ScriptResult |
executeScript(java.io.Reader scriptStream)
Execute the script in the supplied stream
|
ScriptResult |
executeScript(java.io.Reader scriptStream,
boolean exitAtEnd)
Execute the script in the supplied stream.
|
ScriptResult |
executeScript(java.lang.String scriptPath)
Execute the script in the supplied file
|
ScriptResult |
executeScript(java.lang.String scriptPath,
boolean exitAtEnd)
Execute the script in the supplied file
|
java.lang.String |
getAccountInfo()
Get the account info
|
int |
getActiveHighPort()
Get the high port for active mode
|
int |
getActiveLowPort()
Get the low port for active mode
|
java.lang.String |
getClientCertificate()
Get the path of the client certificate for FTPS
|
java.lang.String |
getClientPassphrase()
Get the passphrase used for the client certificate
|
java.lang.String |
getClientPrivateKey()
Get the client private key path
|
java.lang.String |
getClientPrivateKeyPass()
Get the passphrase for the client private key
|
java.util.Map |
getCommandMap()
Get the map of commands
|
java.lang.String |
getCommonName()
Get the set common name for the server.
|
java.lang.String |
getConfigFlags()
Get the config flags
|
FTPConnectMode |
getConnectMode()
Get the connect mode.
|
ProFTPClientInterface |
getFtp()
Get a reference to the client being used
|
boolean |
getIgnoreCommonName()
Get the setting for ignoring the common name in server certificate
validation.
|
java.lang.String |
getKnownHosts()
Get the known hosts path
|
java.lang.String |
getLocalDir()
Get the local working directory
|
java.lang.String |
getLogFile()
Get the name (or full path) of the log file
|
Level |
getLogLevel()
Get the log level
|
int |
getMaxSSLVersion() |
CommandCollector |
getMessageCollector()
Get the message listener
|
java.lang.String |
getParser()
Get the directory listing parser
|
java.lang.String |
getPassword()
Get the user's password
|
int |
getPort()
Get the port number being used.
|
Protocol |
getProtocol()
Get the protocol to be used
|
java.lang.String |
getRecordFile()
Get path of file used to record script to
|
java.lang.String |
getRemoteHost()
Get the remote host name
|
java.lang.String |
getServerCertificate()
Get the path of the server certificate for FTPS, or
the root certificate
|
java.lang.String |
getServerPublicKey()
Get the server public key path
|
int |
getTimeout()
Get the timeout value in seconds.
|
java.lang.String |
getUser()
Get the user
|
ScriptVariable |
getVariable(java.lang.String name)
Get a variable that has been set
|
java.util.Map |
getVariablesMap()
Get the map of variables
|
boolean |
isDebug()
Is debug turned on? Prints out each line before
execution if on.
|
boolean |
isEchoCommand() |
boolean |
isRecording()
Is the engine currently recording commands?
|
static void |
main(java.lang.String[] args) |
void |
quit()
Quit the session
|
CommandResult |
runCommand(java.lang.String command)
Run a command and write the output
|
void |
setAccountInfo(java.lang.String accountInfo)
Set the account info
|
void |
setActivePortRange(int low,
int high)
Set the active mode port range to be used
|
void |
setClientCertificate(java.lang.String clientCertificate)
Set the path of the client certificate for FTPS
|
void |
setClientPassphrase(java.lang.String clientPassphrase)
Set the passphrase used for the client certificate
|
void |
setClientPrivateKey(java.lang.String clientPrivateKey)
Set the client private key path
|
void |
setClientPrivateKeyPass(java.lang.String clientPrivateKeyPass)
Set the passphrase for the client private key
|
void |
setCommonName(java.lang.String commonName)
Set the common name for the server.
|
void |
setConfigFlags(java.lang.String configFlags)
Set the config flags
|
void |
setConnectMode(FTPConnectMode mode)
Set the connect mode.
|
void |
setDebug(boolean debug)
Set debug flag on or off
|
void |
setEchoCommand(boolean echoCommand) |
void |
setFtp(ProFTPClientInterface ftp)
Set the client reference
|
void |
setIgnoreCommonName(boolean ignoreCommonName)
Set whether the common name should be ignored in server certificate
validation.
|
void |
setKnownHosts(java.lang.String knownHosts)
Set the known hosts path
|
void |
setLocalDir(java.lang.String localDir)
Set the local working directory
|
void |
setLogFile(java.lang.String logfile)
Set the name or path of the log file
|
void |
setLogLevel(Level logLevel)
Set the log level
|
void |
setMaxSSLVersion(int maxSSLVersion) |
void |
setParser(java.lang.String parser)
Set the directory listing parser
|
void |
setPassword(java.lang.String password)
Set the password to use
|
void |
setPort(int port)
Set the port to connect to
|
void |
setProtocol(Protocol protocol)
Set the protocol to be used
|
void |
setRecordFile(java.lang.String file)
Set path of file to record script to
|
void |
setRemoteHost(java.lang.String remoteHost)
Set the remote host to connect to
|
void |
setServerCertificate(java.lang.String serverCertificate)
Set the path of the server certificate for FTPS, or
the root certificate
|
void |
setServerPublicKey(java.lang.String serverPublicKey)
Set the server public key path
|
void |
setTimeout(int timeout)
Set the timeout (in seconds).
|
void |
setUser(java.lang.String user)
Set the user
|
void |
setVariable(java.lang.String name,
java.lang.String value)
Set a variable
|
void |
startRecording(java.lang.String file)
Start recording commands to file
|
void |
stopRecording()
Stop recording commands
|
void |
writeToRecordFile(java.lang.String msg)
Write a line to the script record file
|
public ScriptEngine() throws java.io.IOException
java.io.IOException
public ScriptEngine(java.lang.String user, java.lang.String password) throws java.io.IOException
user
- usernamepassword
- user's passwordjava.io.IOException
public CommandResult runCommand(java.lang.String command)
command
- command string including argumentsout
- output stream for feedbackpublic void quit()
out
- output stream for feedbackpublic ScriptResult executeScript(java.lang.String scriptPath)
scriptPath
- full path of the script filejava.io.IOException
FTPException
public ScriptResult executeScript(java.lang.String scriptPath, boolean exitAtEnd)
scriptPath
- full path of the script fileexitAtEnd
- if true, close connection at endjava.io.IOException
FTPException
public ScriptResult executeScript(java.io.Reader scriptStream)
scriptStream
- input stream containing the script filejava.io.IOException
FTPException
public ScriptResult executeScript(java.io.Reader scriptStream, boolean exitAtEnd)
scriptStream
- input stream containing the script fileexitAtEnd
- if true, close connection at endjava.io.IOException
FTPException
public java.util.Map getCommandMap()
public java.util.Map getVariablesMap()
public boolean isEchoCommand()
public void setEchoCommand(boolean echoCommand)
public ScriptVariable getVariable(java.lang.String name)
name
- name of variablepublic void setVariable(java.lang.String name, java.lang.String value)
name
- variable namevalue
- variable valuepublic java.lang.String getConfigFlags()
public void setConfigFlags(java.lang.String configFlags)
configFlags
- config flags to setpublic java.lang.String getKnownHosts()
public void setKnownHosts(java.lang.String knownHosts)
knownHosts
- path to known hosts filepublic java.lang.String getServerPublicKey()
public void setServerPublicKey(java.lang.String serverPublicKey)
serverPublicKey
- path to public keypublic java.lang.String getClientPrivateKey()
public void setClientPrivateKey(java.lang.String clientPrivateKey)
clientPrivateKey
- path to private keypublic java.lang.String getClientPrivateKeyPass()
public void setClientPrivateKeyPass(java.lang.String clientPrivateKeyPass)
clientPrivateKeyPass
- passphrasepublic void startRecording(java.lang.String file) throws java.io.IOException
recordFile
- file to write commands tojava.io.IOException
public void stopRecording() throws java.io.IOException
java.io.IOException
public boolean isRecording()
public java.lang.String getRecordFile()
public void setRecordFile(java.lang.String file)
file
- file pathpublic void writeToRecordFile(java.lang.String msg) throws java.io.IOException
msg
- script linejava.io.IOException
public FTPConnectMode getConnectMode()
public void setConnectMode(FTPConnectMode mode)
mode
- mode to set.public java.lang.String getLocalDir()
public void setLocalDir(java.lang.String localDir)
localDir
- new local working directorypublic java.lang.String getAccountInfo()
public void setAccountInfo(java.lang.String accountInfo)
accountInfo
- account infopublic java.lang.String getParser()
public void setParser(java.lang.String parser)
parser
- directory listing parserpublic CommandCollector getMessageCollector()
public boolean isDebug()
public void setDebug(boolean debug)
debug
- enable or disable debugpublic ProFTPClientInterface getFtp()
public void setFtp(ProFTPClientInterface ftp)
ftp
- client referencepublic java.lang.String getLogFile()
public void setLogFile(java.lang.String logfile) throws java.io.IOException
logfile
- logfile path or namejava.io.IOException
public Level getLogLevel()
public void setLogLevel(Level logLevel)
logLevel
- new log levelpublic java.lang.String getPassword()
public void setPassword(java.lang.String password)
password
- user's passwordpublic int getMaxSSLVersion()
public void setMaxSSLVersion(int maxSSLVersion)
public java.lang.String getClientCertificate()
public void setClientCertificate(java.lang.String clientCertificate)
clientCertificate
- file pathpublic java.lang.String getClientPassphrase()
public void setClientPassphrase(java.lang.String clientPassphrase)
clientPassphrase
- public java.lang.String getServerCertificate()
public void setServerCertificate(java.lang.String serverCertificate)
serverCertificate
- file pathpublic java.lang.String getCommonName()
public void setCommonName(java.lang.String commonName)
common
- name stringpublic boolean getIgnoreCommonName()
public void setIgnoreCommonName(boolean ignoreCommonName)
ignoreCommonName
- public int getPort()
public void setPort(int port)
port
- port usedpublic void setActivePortRange(int low, int high)
low
- low porthigh
- high portpublic int getActiveLowPort()
public int getActiveHighPort()
public Protocol getProtocol()
public void setProtocol(Protocol protocol)
protocol
- protocol to usepublic java.lang.String getRemoteHost()
public void setRemoteHost(java.lang.String remoteHost)
remoteHost
- remote host namepublic boolean canConnect()
public int getTimeout()
public void setTimeout(int timeout)
timeout
- timeout value in secondspublic java.lang.String getUser()
public void setUser(java.lang.String user)
user
- user namepublic static void main(java.lang.String[] args)
Copyright © 2001-2014 Enterprise Distributed Technologies Ltd. All Rights Reserved.