org.openide.execution
Class ScriptType

java.lang.Object
  |
  +--org.openide.ServiceType
        |
        +--org.openide.execution.ScriptType
All Implemented Interfaces:
Serializable

public abstract class ScriptType
extends ServiceType

Base class for scripting interpreters.

See Also:
Serialized Form

Inner Class Summary
static class ScriptType.Context
          Scripting context.
 
Inner classes inherited from class org.openide.ServiceType
ServiceType.Handle, ServiceType.Registry
 
Fields inherited from class org.openide.ServiceType
PROP_NAME
 
Constructor Summary
ScriptType()
           
 
Method Summary
abstract  boolean acceptFileObject(FileObject fo)
          The script type can decide whether it will be able to execute the given file object.
abstract  void addVariable(String name, Object value)
          Adds variable with name to the variables known by the script type.
 Object eval(Reader r)
          Calls eval(Reader, Context) with getDefaultContext() as the second argument.
abstract  Object eval(Reader r, ScriptType.Context context)
          Evaluate the script given in the form of a Reader.
 Object eval(String script)
          Calls eval(String, Context) with getDefaultContext() as the second argument.
abstract  Object eval(String script, ScriptType.Context context)
          Evaluate the script given in the form of a string.
 void exec(Reader r)
          Calls exec(Reader, Context) with getDefaultContext() as the second argument.
abstract  void exec(Reader r, ScriptType.Context context)
          Execute the script given in the form of a Reader.
 void exec(String script)
          Calls exec(String, Context) with getDefaultContext() as the second argument.
abstract  void exec(String script, ScriptType.Context context)
          Execute the script given in the form of a string.
static ScriptType find(Class clazz)
          Find the script type implemented as a given class.
static ScriptType find(String name)
          Find the script type with requested name.
static ScriptType getDefault()
          Deprecated. Probably meaningless, find all available types and filter with acceptFileObject(org.openide.filesystems.FileObject) instead.
static Enumeration scriptTypes()
          Get all registered script types.
 
Methods inherited from class org.openide.ServiceType
addPropertyChangeListener, clone, createClone, displayName, firePropertyChange, getHelpCtx, getName, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptType

public ScriptType()
Method Detail

acceptFileObject

public abstract boolean acceptFileObject(FileObject fo)
The script type can decide whether it will be able to execute the given file object.
Parameters:
fileName -  
Returns:
true if the script can operate on this file

eval

public abstract Object eval(Reader r,
                            ScriptType.Context context)
                     throws InvocationTargetException
Evaluate the script given in the form of a Reader.
Parameters:
r -  
context -  
Returns:
whatever is the result of the script. It can be null.

eval

public final Object eval(Reader r)
                  throws InvocationTargetException
Calls eval(Reader, Context) with getDefaultContext() as the second argument.

eval

public abstract Object eval(String script,
                            ScriptType.Context context)
                     throws InvocationTargetException
Evaluate the script given in the form of a string.
Parameters:
script -  
context -  
Returns:
whatever is the result of the script. It can be null.

eval

public final Object eval(String script)
                  throws InvocationTargetException
Calls eval(String, Context) with getDefaultContext() as the second argument.

exec

public abstract void exec(Reader r,
                          ScriptType.Context context)
                   throws InvocationTargetException
Execute the script given in the form of a Reader.
Parameters:
is -  
context -  
Returns:
whatever is the result of the script. It can be null.

exec

public final void exec(Reader r)
                throws InvocationTargetException
Calls exec(Reader, Context) with getDefaultContext() as the second argument.

exec

public abstract void exec(String script,
                          ScriptType.Context context)
                   throws InvocationTargetException
Execute the script given in the form of a string.
Parameters:
script -  
context -  
Returns:
whatever is the result of the script. It can be null.

exec

public final void exec(String script)
                throws InvocationTargetException
Calls exec(String, Context) with getDefaultContext() as the second argument.

addVariable

public abstract void addVariable(String name,
                                 Object value)
Adds variable with name to the variables known by the script type.
Parameters:
name - the name for the newly created variable
value - initial value variable value (can be null).

scriptTypes

public static Enumeration scriptTypes()
Get all registered script types.
Returns:
enumeration of ScriptTypes

find

public static ScriptType find(Class clazz)
Find the script type implemented as a given class.
Parameters:
clazz - the class of the script type looked for
Returns:
the desired script type or null if it does not exist

find

public static ScriptType find(String name)
Find the script type with requested name.
Parameters:
name - (display) name of script type to find
Returns:
the desired script type or null if it does not exist

getDefault

public static ScriptType getDefault()
Deprecated. Probably meaningless, find all available types and filter with acceptFileObject(org.openide.filesystems.FileObject) instead.

Get the default script type.
Returns:
the default script type


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.