ti.chimera
Class Main

java.lang.Object
  extended byti.chimera.Main

public class Main
extends java.lang.Object

This is where it all begins. The Main class instantiates the registry, the script interpreter, and then evaluates bootstrap.os, which is where everything else happens. The bootstrap.os essentially defines the application.

Version:
0.1
Author:
Rob Clark

Nested Class Summary
static class Main.ChimeraThreadGroup
           
static interface Main.Logger
          A logger's log method is called with log messages, such as loading or starting a plugin, etc.
 
Constructor Summary
Main(java.lang.String[] args, java.lang.String[] sargs)
          Class Constructor.
 
Method Summary
 void addLogger(Main.Logger logger)
          Add a logger.
 void atExit(java.lang.Runnable hook)
          Add some code to run at shutdown time.
 void debug(int level, java.lang.String msg)
           
 void error(java.lang.String msg)
           
 void error(java.lang.String name, java.lang.String msg)
           
static void exit(int status)
          Cause the system to exit, running at-exit-runnables.
 void fatalError(java.lang.String str)
          Called for fatal errors, for example during startup.
 java.io.PrintWriter getErr()
          Get the stderr stream.
 java.lang.String getHistory()
           
 java.io.BufferedReader getIn()
          Get the stdin stream.
 java.io.PrintWriter getOut()
          Get the stdout stream.
 Registry getRegistry()
          Get the Registry.
 WindowManager getWindowManager()
          Get the WindowManager.
 void log(java.lang.String msg)
          Log a message.
static void main(java.lang.String[] args)
          Where it all starts.
 void message(java.lang.String msg)
           
 void removeLogger(Main.Logger logger)
          Remove a logger.
 java.lang.Object restore(java.lang.String key)
          Retrieve some previously stored object.
 void setDebugLevel(int debugLevel)
           
 void setErr(java.io.Writer err)
          Set the error output stream.
 void setIn(java.io.Reader in)
          Set the input stream.
 void setOut(java.io.Writer out)
          Set the output stream.
 void store(java.lang.String key, java.lang.Object obj)
          Store some object in a persistant manner.
 void warning(java.lang.String msg)
           
 void warning(java.lang.String name, java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main(java.lang.String[] args,
            java.lang.String[] sargs)
     throws java.lang.Error
Class Constructor.

Parameters:
args - the command-line arguments
sargs - script args
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Throwable
Where it all starts.

Parameters:
args - the command-line arguments
Throws:
java.lang.Throwable

fatalError

public void fatalError(java.lang.String str)
                throws java.lang.Error
Called for fatal errors, for example during startup. Displays error message and then throws Error which should terminate the thread.

Parameters:
str - the error message
Throws:
java.lang.Error

setIn

public void setIn(java.io.Reader in)
Set the input stream.

Parameters:
in - the new input reader

setOut

public void setOut(java.io.Writer out)
Set the output stream.

Parameters:
out - the new output writer

setErr

public void setErr(java.io.Writer err)
Set the error output stream.

Parameters:
err - the new error output writer

getOut

public java.io.PrintWriter getOut()
Get the stdout stream.

Returns:
the stdout output stream used by the test-harness

getErr

public java.io.PrintWriter getErr()
Get the stderr stream.

Returns:
the stderr output stream used by the test-harness

getIn

public java.io.BufferedReader getIn()
Get the stdin stream.

Returns:
the stdin input stream used by the test-harness

getWindowManager

public final WindowManager getWindowManager()
Get the WindowManager.

Returns:
the window manager

getRegistry

public Registry getRegistry()
Get the Registry.

Returns:
the registry

exit

public static void exit(int status)
Cause the system to exit, running at-exit-runnables. Note that while close runnables will still run if you exit the VM by calling System.exit(int), doing so may cause the VM to hang on some plat- forms, notably windows. (The cause appears to be bad interactions between some close runnables and swing from the context of the shutdown-hook thread.)

Parameters:
status - the exit status

atExit

public void atExit(java.lang.Runnable hook)
Add some code to run at shutdown time. See Runtime.addShutdownHook(java.lang.Thread) for a description of what you can and can't do from a shutdown hook. Unlike addShutdownHook, this method lets you add a shutdown hook from the context of a running shutdown hook.

Parameters:
hook - the hook to run at shutdown

store

public void store(java.lang.String key,
                  java.lang.Object obj)
Store some object in a persistant manner. The object must implement the Serializable interface.

Parameters:
key - the key
obj - the object to store
See Also:
restore(java.lang.String)

restore

public java.lang.Object restore(java.lang.String key)
Retrieve some previously stored object.

Parameters:
key - the key
Returns:
the previously stored object, or null if none
See Also:
store(java.lang.String, java.lang.Object)

addLogger

public void addLogger(Main.Logger logger)
Add a logger.


removeLogger

public void removeLogger(Main.Logger logger)
Remove a logger.


log

public void log(java.lang.String msg)
Log a message. This is called by various parts of the chimera infrastructure, for example when plugins are loaded or view's are created.

Parameters:
msg - the informational message to log

setDebugLevel

public void setDebugLevel(int debugLevel)

getHistory

public java.lang.String getHistory()

error

public void error(java.lang.String msg)

error

public void error(java.lang.String name,
                  java.lang.String msg)

warning

public void warning(java.lang.String msg)

warning

public void warning(java.lang.String name,
                    java.lang.String msg)

message

public void message(java.lang.String msg)

debug

public void debug(int level,
                  java.lang.String msg)