Tea Java Runtime API
Version 3.2.5

com.pdmfc.tea.apps
Class STeaShell

java.lang.Object
  extended by com.pdmfc.tea.apps.STeaShell

public class STeaShell
extends java.lang.Object

Implements a Tea shell.


Constructor Summary
STeaShell()
           
 
Method Summary
 void addImportDirPath(java.lang.String path)
          Adds a component to the end of the list of paths used by the import function in the Tea program.
 void addImportDirResource(java.lang.String resourceName)
          Addes a component to the end of the list of paths used by the import function in the Tea program.
 int execute(java.lang.String[] args)
          Executes the Tea script previously specified.
static void main(java.lang.String[] args)
          Runs a Tea script contained in a file or read from the Java process standard input.
 void setScriptFile(java.lang.String path)
          Specifies the pathname of the file containing the Tea script to be executed.
 void setScriptResource(java.lang.String resourceName)
          Specifies a Java resource whose contents are the Tea script to execute.
 void setScriptUrl(java.net.URL url)
          Specifies the URL where the script to be executed is to be read from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

STeaShell

public STeaShell()
Method Detail

setScriptFile

public void setScriptFile(java.lang.String path)
Specifies the pathname of the file containing the Tea script to be executed. The Tea script will be executed when the execute(String[]) method is called.

Parameters:
path - A file path name.
Throws:
java.io.IOException - Thrown if the given path is not valid.

setScriptUrl

public void setScriptUrl(java.net.URL url)
Specifies the URL where the script to be executed is to be read from. The URL contents will only be read when the execute(String[]) method is called.

Parameters:
url - The URL to read the Tea script from.

setScriptResource

public void setScriptResource(java.lang.String resourceName)
Specifies a Java resource whose contents are the Tea script to execute. The resource is read only when the execute(String[]) method is called.

Parameters:
resourceName - The Java resource containing the Tea script to be executed.

addImportDirPath

public void addImportDirPath(java.lang.String path)
Adds a component to the end of the list of paths used by the import function in the Tea program. The given path is added to the list without any modifications.

Parameters:
path - The path being added to the path list.

addImportDirResource

public void addImportDirResource(java.lang.String resourceName)
Addes a component to the end of the list of paths used by the import function in the Tea program. The given path is assumed to be a Java resource name. The component added to the path list is the URL representing that Java resource.

Parameters:
resourceName - The name of a Java resource that will be added to the list of import directories.

execute

public int execute(java.lang.String[] args)
            throws java.io.IOException,
                   STeaException
Executes the Tea script previously specified. If no script was specified then it trys to read the script from the Java process standard input.

Parameters:
args - The command line arguments to pass to the script. These will be accesible in the Tea code as a list stored in the argv variable.
Throws:
java.io.IOException - Thrown if there were any problems reading the Tea script.
STeaException - Thrown if there were any problems compiling or executing the script. This exception can actually be an instance of SCompileException or SRuntimeException.

main

public static void main(java.lang.String[] args)
Runs a Tea script contained in a file or read from the Java process standard input.

The first command line argument is taken to be the pathname of a Tea script and it will be executed. All the remaining arguments are passed as command line arguments to the Tea script. If no command line arguments are given then it reads a Tea script from standard input.


Tea Java Runtime API
Version 3.2.5

© 2009 PDM&FC, All Rights Reserved.