com.ibm.jc.tools
Class JCShell

java.lang.Object
  extended byGetOptSpec
      extended bycom.ibm.jc.tools.JCShell

public class JCShell
extends GetOptSpec

JCShell: JavaCard shell

This shell allows on-line interoperation with a JavaCard and the applets running on such a card. In addition to this interactive mode it is also possible to run script files containing these commands.

The JCShell can be used to test applet behavior and to run regression tests automatically. The shell is extensible to address custom behavior of applets.

See Also:
Serialized Form

Nested Class Summary
static interface JCShell.QuitListener
           
 
Field Summary
static int ABBREVMATCH
           
static int EXACTMATCH
           
static int NOMATCH
          Type of matches for equalsCmd
static java.io.PrintWriter out
           
 
Method Summary
static java.lang.String dateToString(int date)
          Return a String representing a date.
static void error(java.lang.String msg)
          Some error occurred.
static boolean executeDefun(java.lang.Object[] defun, java.util.Vector argv)
           
static boolean executeScript(java.lang.String name, java.io.FileReader in, java.util.Vector argv)
           
static void exit(int status, java.lang.String message)
          Exit shell with given status.
static void flush()
          Flush output.
static java.lang.String formatStrings(java.lang.String[] strs, int indent, int maxWidth, java.lang.String sep)
          Return a string with the formatted listing of the specified algorithms An array { A, B, C, D, E, F, G } of algorithm names is display in the form:
static JCShellPlugin getAppletPlugin()
           
static java.lang.String getLastError()
           
static java.lang.String getPrompt()
           
static java.lang.String getVariable(java.lang.String name)
           
static void initialize(java.lang.String[] argv, java.io.PrintWriter out)
           
static void interactiveInput()
           
static void lineInput(java.lang.String line)
           
static void main(java.lang.String[] argv)
           
static int matchStrings(java.lang.String arg, java.lang.String spec)
          Compare a string against some command specification.
static java.lang.String pad(java.lang.String s, int width, boolean truncate)
          Pad some string
static JCTerminal popTerminalFilter()
          Remove top most filter terminal.
static void print(java.lang.String msg)
          Print output.
static void println(java.lang.String msg)
          Print output.
static void pushTerminalFilter(JCTerminal term)
          Applied some terminal filter to currently open terminal.
static java.lang.String releaseToString(int r)
          Return a String representing release data.
static void setClassLoader(java.lang.ClassLoader loader)
           
static void setQuitListener(JCShell.QuitListener listener)
           
static void setVariable(java.lang.String name, java.lang.String value)
           
static java.util.Vector splitIntoArgv(java.lang.String arg, int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

public static java.io.PrintWriter out

NOMATCH

public static int NOMATCH
Type of matches for equalsCmd


ABBREVMATCH

public static int ABBREVMATCH

EXACTMATCH

public static int EXACTMATCH
Method Detail

initialize

public static void initialize(java.lang.String[] argv,
                              java.io.PrintWriter out)
                       throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] argv)

executeScript

public static boolean executeScript(java.lang.String name,
                                    java.io.FileReader in,
                                    java.util.Vector argv)

executeDefun

public static boolean executeDefun(java.lang.Object[] defun,
                                   java.util.Vector argv)

interactiveInput

public static void interactiveInput()

getPrompt

public static java.lang.String getPrompt()

lineInput

public static void lineInput(java.lang.String line)

pushTerminalFilter

public static void pushTerminalFilter(JCTerminal term)
Applied some terminal filter to currently open terminal.


popTerminalFilter

public static JCTerminal popTerminalFilter()
Remove top most filter terminal.

Returns:
top most filter terminal.

splitIntoArgv

public static java.util.Vector splitIntoArgv(java.lang.String arg,
                                             int offset)

setVariable

public static void setVariable(java.lang.String name,
                               java.lang.String value)

getVariable

public static java.lang.String getVariable(java.lang.String name)

getLastError

public static java.lang.String getLastError()

getAppletPlugin

public static JCShellPlugin getAppletPlugin()

setClassLoader

public static void setClassLoader(java.lang.ClassLoader loader)

setQuitListener

public static void setQuitListener(JCShell.QuitListener listener)

exit

public static void exit(int status,
                        java.lang.String message)
Exit shell with given status.


error

public static void error(java.lang.String msg)
Some error occurred.


println

public static void println(java.lang.String msg)
Print output.


print

public static void print(java.lang.String msg)
Print output.


flush

public static void flush()
Flush output.


pad

public static java.lang.String pad(java.lang.String s,
                                   int width,
                                   boolean truncate)
Pad some string

Parameters:
s - String to pad
width - pad to this field length. Positive values pad on right side with blanks. Negative values pad on the left side.
truncate - if true truncate string to match field width

releaseToString

public static java.lang.String releaseToString(int r)
Return a String representing release data.

Parameters:
r - the least significant 16 bits contain the release data

dateToString

public static java.lang.String dateToString(int date)
Return a String representing a date.

Parameters:
date - the least significant 16 bits contain the date

matchStrings

public static int matchStrings(java.lang.String arg,
                               java.lang.String spec)
Compare a string against some command specification. The string might be abbreviated. Each syllable, delimited by a `-', might be abbreviated separately.


formatStrings

public static java.lang.String formatStrings(java.lang.String[] strs,
                                             int indent,
                                             int maxWidth,
                                             java.lang.String sep)
Return a string with the formatted listing of the specified algorithms An array { A, B, C, D, E, F, G } of algorithm names is display in the form:
   A C E G
   B D F
 

Parameters:
strs - the list of strings
indent - each line starts with that many spaces
maxWidth - each line shall not be longer than that
sep - the string which separates columns of algorithms.
Returns:
a string which comprises one or several lines. It ends with a new line.