autohit.vm
Class VMLoader

java.lang.Object
  extended byautohit.vm.VMLoader

public class VMLoader
extends java.lang.Object

Root loader. Basic caching loader half-singleton. It shares the routine cache, but the call cache is local. It does not check to see if anything was updated. Be sure to call init after instantiation or behavior is undefined! It isn't entirely threadsafe, but good enough.

It is also responsible for creating cores, and giving logging and universe access to a VM.

A loader is not "valid" until both init() and create() are called.

Version:
1.0 Version History EPG - Initial - 12may03
Author:
Erich P. Gatejen

Field Summary
 AutohitLogInjectorWrapper log
           
 SystemContext sc
           
 
Constructor Summary
VMLoader()
          Default Constructor.
 
Method Summary
 VMCore create()
          Create a core.
 void flush()
          Flush the entire routine cache
 void flush(java.lang.String name)
          Flush a specific routine out fo the cache
 Call get(java.lang.String name, VMCore core, AutohitLogInjectorWrapper li)
          Get a call.
 void init(SystemContext sctx)
          Initializer.
 VMExecutable load(java.lang.String name)
          Load
 java.lang.String property(java.lang.String name)
          Gets a property from the SystemContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sc

public SystemContext sc

log

public AutohitLogInjectorWrapper log
Constructor Detail

VMLoader

public VMLoader()
Default Constructor.

Method Detail

init

public void init(SystemContext sctx)
Initializer.

Parameters:
sctx - the system context

create

public VMCore create()
Create a core.


load

public VMExecutable load(java.lang.String name)
                  throws VMException
Load

Parameters:
name - of routine to load
Returns:
an executable
Throws:
VMException - unable to load.

get

public Call get(java.lang.String name,
                VMCore core,
                AutohitLogInjectorWrapper li)
         throws VMException
Get a call. If it isn't in the cache, load it. There is no thread safety here at all! However, it shouldn't matter since there is a loader per VM.

Parameters:
name - of routine to load
core - a VMCore that holds a callcache
li - log injector to give to the call
Returns:
runnable call
Throws:
VMException - unable to load.

flush

public void flush()
Flush the entire routine cache

Throws:
VMException - if it locked by something else.

flush

public void flush(java.lang.String name)
Flush a specific routine out fo the cache

Throws:
VMException - if it locked by something else.

property

public java.lang.String property(java.lang.String name)
Gets a property from the SystemContext. Normally, you should handle all system interaction through a Universe. Don't use this unless you have no choice. Returns the value or null if it does not exist

Parameters:
name - of the property
Returns:
the value as a String or null if it doesn't exist


Test.