|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.enterprisedt.net.ftp.script.ScriptEngine
public class ScriptEngine
Scripting engine, used to load FTP scripts and execute them. Generally, the only methods used should be the constructor and the executeScript() methods. The setter methods should be used with caution. Typically, when the script is run these setter methods are called to set various properties. This means any properties manually set with these methods will be overwritten.
| Constructor Summary | |
|---|---|
ScriptEngine()
Default constructor |
|
ScriptEngine(java.lang.String user,
java.lang.String password)
Constructor. |
|
| Method Summary | |
|---|---|
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 |
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.util.Map |
getCommandMap()
Get the map of commands |
java.lang.String |
getCommonName()
Get the set common name for the server. |
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 |
CommandCollector |
getMessageCollector()
Get the message listener |
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 |
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 |
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 |
setCommonName(java.lang.String commonName)
Set the common name for the server. |
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 |
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 |
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
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 password
java.io.IOException| Method Detail |
|---|
public CommandResult runCommand(java.lang.String command)
command - command string including argumentsout - output stream for feedback
public void quit()
out - output stream for feedbackpublic ScriptResult executeScript(java.lang.String scriptPath)
scriptPath - full path of the script file
java.io.IOException
FTPException
public ScriptResult executeScript(java.lang.String scriptPath,
boolean exitAtEnd)
scriptPath - full path of the script fileexitAtEnd - if true, close connection at end
java.io.IOException
FTPExceptionpublic ScriptResult executeScript(java.io.Reader scriptStream)
scriptStream - input stream containing the script file
java.io.IOException
FTPException
public ScriptResult executeScript(java.io.Reader scriptStream,
boolean exitAtEnd)
scriptStream - input stream containing the script fileexitAtEnd - if true, close connection at end
java.io.IOException
FTPExceptionpublic 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 variable
public void setVariable(java.lang.String name,
java.lang.String value)
name - variable namevalue - variable valuepublic java.lang.String getKnownHosts()
public void setKnownHosts(java.lang.String knownHosts)
knownHosts - path to known hosts file
public void startRecording(java.lang.String file)
throws java.io.IOException
recordFile - file to write commands to
java.io.IOException
public void stopRecording()
throws java.io.IOException
java.io.IOExceptionpublic boolean isRecording()
public java.lang.String getRecordFile()
public void setRecordFile(java.lang.String file)
file - file path
public void writeToRecordFile(java.lang.String msg)
throws java.io.IOException
msg - script line
java.io.IOExceptionpublic 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 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 name
java.io.IOExceptionpublic 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 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 used
public 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)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||