autohit.call
Class Call

java.lang.Object
  extended byautohit.call.Call
Direct Known Subclasses:
Call_CHECK_PROCESS, Call_DATE, Call_DELETE_TABLE, Call_DUMP2LOG, Call_EVALSTRING, Call_FREE, Call_GET_SPROP, Call_GET_TABLE, Call_GLOBAL_UNIQUE_INT, Call_INSERT_TABLE, Call_INSTANCE, Call_LOAD_UNI2STRING, Call_LOG, Call_METHOD, Call_NEW_TABLE, Call_QUERY_TABLE, Call_RANDOM, Call_REMOVE_TABLE, Call_RUN, Call_UNIQUE_INT, Call_UNISIZE, Call_WAIT

public abstract class Call
extends java.lang.Object

The abstract class to all the callable functions. Every CALL should implement this. The call will get passed parameters by name out of core. IMPORTANT!!!! Calls should not have any fields! Those that are already provided are inherently thread safe. Calls are cached per VM and reused as often as possible. There will be no thread-safety issues with the VMCore or log, but the SystemContecxt and Universe may be shared.

Version:
1.1 Version HistoryEPG - Initial - 14May03
EPG - reorganize to make Call the base class - 10Sep03
Author:
Erich P. Gatejen

Field Summary
static java.lang.String CALL_TEXT_HEADER
           
 AutohitLogInjectorWrapper log
          Primary Logger
 SystemContext sc
          System Context
 Universe u
          Our simple little universe.
 VMCore vmc
          Core
 
Constructor Summary
Call()
           
 
Method Summary
abstract  java.lang.String call()
          Execute it.
abstract  java.lang.String call(Universe uni)
          Execute using the passed universe, rather than the loaded.
 void debug(java.lang.String text)
          Log a debugging statement.
 java.lang.Object desired(java.lang.String item)
          Get a desired parameter.
 java.lang.String desiredString(java.lang.String item)
          Get a desired parameter.
 void error(java.lang.String text)
          Log an error statement.
 java.lang.String format(java.lang.String text)
          Return a formatted text.
 void info(java.lang.String text)
          Log an info statement.
abstract  void load_chain()
          Implement this to handle load time initialization.
 void load(VMCore core, SystemContext sctx, AutohitLogInjectorWrapper logger)
          This will be called to set references to the environment and usable Universe.
abstract  java.lang.String name()
          Implement this to return the name of the CALL
 java.lang.String optionalString(java.lang.String item)
          Get a optional parameter.
 java.lang.Object required(java.lang.String item)
          Get a required parameter.
 java.lang.Object required(java.lang.String item, java.lang.Class classtype)
          Get a required parameter.
 java.lang.Object requiredPersist(java.lang.String item, java.lang.Class classtype)
          Get a required persist object.
 java.lang.String requiredString(java.lang.String item)
          Get a required parameter that must be a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CALL_TEXT_HEADER

public static final java.lang.String CALL_TEXT_HEADER
See Also:
Constant Field Values

vmc

public VMCore vmc
Core


sc

public SystemContext sc
System Context


log

public AutohitLogInjectorWrapper log
Primary Logger


u

public Universe u
Our simple little universe.

Constructor Detail

Call

public Call()
Method Detail

load_chain

public abstract void load_chain()
                         throws CallException
Implement this to handle load time initialization. The four main fields will already be set--vmc, sc, log, and u. You must implement this, but you don't have to do anything. Remember that calls are cached per VM and reused as often as possible. There will be no thread-safety issues with the VMCore or log, but the SystemContecxt and Universe may be shared.

Throws:
CallException

name

public abstract java.lang.String name()
Implement this to return the name of the CALL

Returns:
name of the CALL

call

public abstract java.lang.String call()
                               throws CallException
Execute it.

Returns:
the result or null if there is no result
Throws:
CallException

call

public abstract java.lang.String call(Universe uni)
                               throws CallException
Execute using the passed universe, rather than the loaded.

Parameters:
uni - a universe
Returns:
the result or null if there is no result
Throws:
CallException
See Also:
Universe

load

public void load(VMCore core,
                 SystemContext sctx,
                 AutohitLogInjectorWrapper logger)
          throws CallException
This will be called to set references to the environment and usable Universe.

Parameters:
core - is a reference to the environment core
sctx - is a system context
logger - the log target
Throws:
CallException
See Also:
VMCore, SystemContext

debug

public void debug(java.lang.String text)
Log a debugging statement.

Parameters:
text - The text of the statement.

error

public void error(java.lang.String text)
Log an error statement.

Parameters:
text - The text of the statement.

info

public void info(java.lang.String text)
Log an info statement.

Parameters:
text - The text of the statement.

format

public java.lang.String format(java.lang.String text)
Return a formatted text. Useful for making Exception messages.

Parameters:
text - The text of the statement.
Returns:
the formatted text.

desired

public java.lang.Object desired(java.lang.String item)
Get a desired parameter. If it is not found, it will post an error and return null.

Parameters:
item - Name of the parameter
Returns:
the object or null

desiredString

public java.lang.String desiredString(java.lang.String item)
Get a desired parameter. If it is not found or is not a String, it will post an error and return null.

Parameters:
item - Name of the parameter
Returns:
the string

optionalString

public java.lang.String optionalString(java.lang.String item)
Get a optional parameter. If it is found but is not a String, it will post an error and return null. If it is not found, it will just return null, without and error.

Parameters:
item - Name of the parameter
Returns:
the string

required

public java.lang.Object required(java.lang.String item)
                          throws CallException
Get a required parameter. If it is not found, it will throw an exception.

Parameters:
item - Name of the parameter
Returns:
the object
Throws:
CallException

requiredString

public java.lang.String requiredString(java.lang.String item)
                                throws CallException
Get a required parameter that must be a String. If it is not found or it is not a String, it will throw an exception.

Parameters:
item - Name of the parameter
Returns:
the string
Throws:
CallException

required

public java.lang.Object required(java.lang.String item,
                                 java.lang.Class classtype)
                          throws CallException
Get a required parameter. If it is not found, it will throw an exception. It will also make sure it is a certain class type. If not, it will throw an exception.

Parameters:
item - Name of the parameter
classtype - Class is should be.
Returns:
the object
Throws:
CallException

requiredPersist

public java.lang.Object requiredPersist(java.lang.String item,
                                        java.lang.Class classtype)
                                 throws CallException
Get a required persist object. If it is not found, it will throw an exception. It will also make sure it is a certain class type. If not, it will throw an exception.

Parameters:
item - Name of the parameter
classtype - Class is should be.
Returns:
the object
Throws:
CallException


Test.