aspoev.interpreter
Class Interpreter

java.lang.Object
  extended byaspoev.interpreter.Interpreter

public class Interpreter
extends java.lang.Object

A Vejal interpreter that creates meta-classes and meta-objects in Java. This class more or less only governs meta-classes, because for the most part, vejal meta data knows how to handle itself when executed. Meta-Objects (instances of these Meta-Classes) are kept within the current ExecutionEnvironment.


Field Summary
protected  DatabaseManager database
           
protected static Interpreter instance
           
protected  java.util.Hashtable loadedClasses
           
protected static java.util.Hashtable threadMap
           
 
Constructor Summary
protected Interpreter()
           
 
Method Summary
 TypeReferenceElement bindVersion(TypeReferenceElement type)
           
static DatabaseManager getDatabaseManager()
          Returns the database manager associated with the interpreter.
 java.util.Collection getDefinedClasses()
          Returns a collection of types defined in the interpreter.
 java.util.Collection getDefinedTypes()
          Returns a collection of types defined in the interpreter.
static ExecutionEnvironment getEnvironment()
          Returns the execution environment associated with the current thread.
 java.util.Collection getLoadedClasses()
           
static Interpreter instance()
          Returns the singleton instance of the interpreter.
 boolean isDefinedType(TypeReferenceElement type)
          Checks to see if a type's name is known in the interpreter - if so, then it has defined versions.
 boolean isDefinedVersion(TypeReferenceElement type)
          Checks to see if a type has a corresponding class definition.
 boolean isLoadedClassName(java.lang.String className)
           
static void loadClass(ClassDeclarationElement classDecl)
           
protected  void loadDefinedClasses()
          This method is called during initialization.
 ClassDeclarationElement lookUpClass(TypeReferenceElement type)
          Returns the class definition associated with the argument type.
static void registerEnvironment(ExecutionEnvironment env)
          Registers the provided execution environment with the current thread.
static void registerEnvironment(ExecutionEnvironment env, java.lang.Thread thread)
          Registers the provided execution environment with the provided thread.
 void run()
          Start the Vejal program.
 void run(TypeReferenceElement type, ArgumentListElement args)
          Looks for a main method in the specified type, and then starts execution from that point with a new thread and execution environment.
static void shutDown()
           
 void startUp()
          Starts the interpreter - Opens the database and loads all defined types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static Interpreter instance

threadMap

protected static java.util.Hashtable threadMap

database

protected DatabaseManager database

loadedClasses

protected java.util.Hashtable loadedClasses
Constructor Detail

Interpreter

protected Interpreter()
Method Detail

startUp

public void startUp()
Starts the interpreter - Opens the database and loads all defined types.


bindVersion

public TypeReferenceElement bindVersion(TypeReferenceElement type)

instance

public static Interpreter instance()
Returns the singleton instance of the interpreter.


getDatabaseManager

public static DatabaseManager getDatabaseManager()
Returns the database manager associated with the interpreter.


getDefinedClasses

public java.util.Collection getDefinedClasses()
Returns a collection of types defined in the interpreter.


getDefinedTypes

public java.util.Collection getDefinedTypes()
Returns a collection of types defined in the interpreter.


getEnvironment

public static ExecutionEnvironment getEnvironment()
Returns the execution environment associated with the current thread.


getLoadedClasses

public java.util.Collection getLoadedClasses()

isDefinedType

public boolean isDefinedType(TypeReferenceElement type)
Checks to see if a type's name is known in the interpreter - if so, then it has defined versions.


isDefinedVersion

public boolean isDefinedVersion(TypeReferenceElement type)
Checks to see if a type has a corresponding class definition.


isLoadedClassName

public boolean isLoadedClassName(java.lang.String className)

loadClass

public static void loadClass(ClassDeclarationElement classDecl)

loadDefinedClasses

protected void loadDefinedClasses()
This method is called during initialization. It queries the database for all previosly defined classes and regsisters them.


lookUpClass

public ClassDeclarationElement lookUpClass(TypeReferenceElement type)
Returns the class definition associated with the argument type.


registerEnvironment

public static void registerEnvironment(ExecutionEnvironment env)
Registers the provided execution environment with the current thread.


registerEnvironment

public static void registerEnvironment(ExecutionEnvironment env,
                                       java.lang.Thread thread)
Registers the provided execution environment with the provided thread.


run

public void run()
Start the Vejal program. Vejal execution mandates that a class be defined named 'Main' with a starting method named 'main' (and taking no parameters)


run

public void run(TypeReferenceElement type,
                ArgumentListElement args)
Looks for a main method in the specified type, and then starts execution from that point with a new thread and execution environment.


shutDown

public static void shutDown()