tribble.net.ftp.shell
Class Interp

java.lang.Object
  extended by tribble.net.ftp.shell.Interp
All Implemented Interfaces:
CommandCodes, VarNames

 class Interp
extends java.lang.Object
implements CommandCodes, VarNames

FTP command script interpreter.

Source code:
Available at: http://david.tribble.com/src/java/tribble/net/ftp/shell/Interp.java
Documentation:
Available at: http://david.tribble.com/docs/tribble/net/ftp/shell/Interp.html

Since:
API 1.0, 2007-03-15
Version:
$Revision: 1.53 $ $Date: 2008/09/14 17:48:02 $
Author:
David R. Tribble (david@tribble.com).

Copyright ©2007-2008 by David R. Tribble, all rights reserved.
Permission is granted to any person or entity except those designated by by the United States Department of State as a terrorist, or terrorist government or agency, to use and distribute this source code provided that the original copyright notice remains present and unaltered.

See Also:
FTPCommandInterpreter, CommandParser, ExecFrame, BlockDef

Field Summary
(package private) static java.lang.String LOCAL_NL
          Local native JVM newline character sequence.
(package private)  boolean m_exit
          Exit command flag.
(package private)  boolean m_isVerbose
          Generate verbose command tracing output (current setting).
(package private)  boolean m_limitCmds
          Limit the number of commands executed (to 1,000).
(package private)  java.io.File m_localDir
          Local directory name.
(package private)  long m_nExecs
          Commands (statements) executed.
(package private)  java.util.Random m_rand
          Pseudo-random number generator.
(package private)  long m_startTime
          Execution start time.
(package private)  boolean m_stop
          Execution interrupt/stop flag.
(package private)  long m_time
          Current date/time (as msec since 1970-01-01 00:00:00Z).
(package private)  boolean m_verbose
          Generate verbose command tracing output (global setting).
(package private) static java.lang.String REV
          Revision information.
(package private) static java.lang.String SYS_CURDIR
          Local current directory.
(package private) static java.lang.String SYS_DIRSEP
          Local native directory pathname separator.
 
Fields inherited from interface tribble.net.ftp.shell.CommandCodes
CMD__UNDEF, CMD_ADD, CMD_AND, CMD_APPEND, CMD_BINARY, CMD_BLOCK, CMD_BREAK, CMD_BUILTIN, CMD_CALL, CMD_CDUP, CMD_CHDIR, CMD_CLOSE, CMD_CONCAT, CMD_COND, CMD_CONNECT, CMD_CONTINUE, CMD_DEBUG, CMD_DECR, CMD_DELETE, CMD_DIR, CMD_DIV, CMD_ECHO, CMD_EQ, CMD_EXEC, CMD_EXIT, CMD_FALSE, CMD_FILENAME, CMD_FOR, CMD_FOREACH, CMD_FUNC, CMD_FUNC_FORMAT, CMD_FUNC_INDEX, CMD_FUNC_LCASE, CMD_FUNC_LEN, CMD_FUNC_NORM, CMD_FUNC_REPL, CMD_FUNC_RINDEX, CMD_FUNC_SUB, CMD_FUNC_TRIM, CMD_FUNC_UCASE, CMD_GE, CMD_GET, CMD_GLOB, CMD_GOTO, CMD_GT, CMD_HELP, CMD_IF, CMD_INCR, CMD_LABEL, CMD_LCHDIR, CMD_LE, CMD_LOCAL, CMD_LT, CMD_MATCH, CMD_MGET, CMD_MKDIR, CMD_MOD, CMD_MPUT, CMD_MUL, CMD_NE, CMD_NEG, CMD_NMATCH, CMD_NO_N, CMD_NOP, CMD_NOT, CMD_OPEN, CMD_OR, CMD_POS, CMD_PRINT, CMD_PUT, CMD_PWD, CMD_READ, CMD_REMOTE, CMD_RENAME, CMD_REPEAT, CMD_RETURN, CMD_RMDIR, CMD_SET, CMD_SHELL, CMD_SLEEP, CMD_STATUS, CMD_STREQ, CMD_SUB, CMD_SUBSCR, CMD_SYSTEM, CMD_TEST, CMD_TEST_DIR, CMD_TEST_EXEC, CMD_TEST_EXISTS, CMD_TEST_FILE, CMD_TEST_MODTIME, CMD_TEST_READ, CMD_TEST_SIZE, CMD_TEST_WRITE, CMD_TEXT, CMD_TIMEOUT, CMD_TOK, CMD_TRUE, CMD_USER, CMD_VAR, CMD_WAITFOR, CMD_WHILE, CMD_WRITE, CMD_X_INTERRUPT, CMD_X_SESSIONS, CMD_X_STACK, CMD_X_STOP, CMD_X_VARS, CMD_X_VERBOSE, VAL_EMPTY, VAL_FALSE, VAL_FALSE_WD, VAL_ONE, VAL_TRUE, VAL_TRUE_WD, VAL_ZERO
 
Fields inherited from interface tribble.net.ftp.shell.VarNames
VAR_CMDPORT, VAR_COMMANDCNT, VAR_DATAPORT, VAR_ERROR, VAR_ERRORCMD, VAR_ERRORCNT, VAR_ERRORMSG, VAR_FILE, VAR_FILE_DIR, VAR_FILE_DIRSEP, VAR_FILE_EXT, VAR_FILE_FILE, VAR_FILE_GROUP, VAR_FILE_HOST, VAR_FILE_NAME, VAR_FILE_OWNER, VAR_FILE_PATH, VAR_FILE_PERMS, VAR_FILE_SIZE, VAR_FILE_TYPE, VAR_FILENAME, VAR_HOST, VAR_LINENUM, VAR_LOCALDIR, VAR_PASSWORD, VAR_PORT, VAR_RANDOM, VAR_REMOTEDIR, VAR_SESSIONCNT, VAR_TIME, VAR_TIMEOUT, VAR_TZOFFSET, VAR_USER
 
Constructor Summary
Interp(CommandNode cmds, java.io.PrintStream out, java.io.PrintStream err)
          Constructor.
 
Method Summary
(package private)  int execute()
          Execute (interpret) the command script.
(package private)  void stop()
          Stop this currently running FTP command script interpreter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REV

static final java.lang.String REV
Revision information.

See Also:
Constant Field Values

LOCAL_NL

static final java.lang.String LOCAL_NL
Local native JVM newline character sequence.


SYS_DIRSEP

static final java.lang.String SYS_DIRSEP
Local native directory pathname separator.


SYS_CURDIR

static final java.lang.String SYS_CURDIR
Local current directory.


m_localDir

java.io.File m_localDir
Local directory name.


m_startTime

long m_startTime
Execution start time.


m_time

long m_time
Current date/time (as msec since 1970-01-01 00:00:00Z).


m_nExecs

long m_nExecs
Commands (statements) executed.


m_rand

java.util.Random m_rand
Pseudo-random number generator.


m_stop

volatile boolean m_stop
Execution interrupt/stop flag.


m_exit

boolean m_exit
Exit command flag.


m_verbose

boolean m_verbose
Generate verbose command tracing output (global setting).


m_isVerbose

boolean m_isVerbose
Generate verbose command tracing output (current setting).


m_limitCmds

boolean m_limitCmds
Limit the number of commands executed (to 1,000).

Constructor Detail

Interp

Interp(CommandNode cmds,
       java.io.PrintStream out,
       java.io.PrintStream err)
 throws java.lang.IllegalArgumentException
Constructor.

Parameters:
cmds - Parsed commands (statements) from a source command script.
out - Output stream.
err - Error output stream.
Throws:
java.lang.IllegalArgumentException - (unchecked) Thrown if cmds is malformed.
Since:
1.45, 2007-05-19 (1.1, 2007-03-16)
Method Detail

stop

void stop()
Stop this currently running FTP command script interpreter. This sets an internal flag, which is checked before the next command is executed, and every 3 seconds while the 'sleep' command is executing.

Since:
1.37, 2007-05-05

execute

int execute()
Execute (interpret) the command script.

Returns:
The final exit value of the script.
Since:
1.1, 2007-03-16