|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object context.arch.BaseObject context.arch.interpreter.Interpreter
This class is the basic interpreter.
BaseObject
Field Summary | |
static boolean |
DEBUG
Debug flag |
static int |
DEFAULT_PORT
Default port to use for interpreters |
protected Attributes |
inAttributes
|
protected java.util.Hashtable |
inAttributeTypes
|
static java.lang.String |
INTERPRET
Tag for interpreter |
static java.lang.String |
INTERPRET_REPLY
Tag for interpreterReply |
static java.lang.String |
INTERPRETER_TYPE
The tag for the type of this object |
protected Attributes |
outAttributes
|
protected java.util.Hashtable |
outAttributeTypes
|
Fields inherited from class context.arch.BaseObject |
BASEOBJECT_TYPE, communications, DISABLE_PORT, discoverer, EXIT_OK, gFrame, handlers, ID, parser, PING, PING_REPLY, QUERY_DESCRIPTION, QUERY_DESCRIPTION_REPLY, serviceHandlers |
Constructor Summary | |
Interpreter(int port)
Constructor that creates a BaseObject with the given port and sets the incoming and outgoing attributes. |
Method Summary | |
DataObject |
callInterpreter(DataObject data,
java.lang.String error)
This method ensures that the incoming attributes are correct and calls interpretData(). |
protected java.lang.String |
getInAttributeType(java.lang.String name)
Returns the attribute type with the given name for incoming attributes |
DataObject |
getInterpreterDescription()
Returns the interpreter description that should be overloaded |
protected java.lang.String |
getOutAttributeType(java.lang.String name)
Returns the attribute type with the given name for outgoing attributes |
java.lang.String |
getType()
Returns the type of the object This method should be overridden |
DataObject |
getUserDescription()
Overloads the BaseObject method |
protected abstract Attributes |
interpretData(Attributes data)
This abstract method interprets the given data and returns it. |
protected boolean |
isInAttribute(java.lang.String name)
Checks if the given incoming attribute is an attribute of this interpreter |
protected boolean |
isOutAttribute(java.lang.String name)
Checks if the given outgoing attribute is an attribute of this interpreter |
protected DataObject |
runInterpreterMethod(DataObject data,
java.lang.String error)
This is an empty method that should be overridden by objects that subclass from this class. |
DataObject |
runUserMethod(DataObject data)
This method is meant to handle any internal methods that the baseObject doesn't handle. |
protected void |
setInAttribute(java.lang.String name,
java.lang.String type)
Adds an incoming attribute |
protected abstract Attributes |
setInAttributes()
Sets the incoming attributes for the interpreter |
protected void |
setOutAttribute(java.lang.String name,
java.lang.String type)
Adds an outgoing attribute |
protected abstract Attributes |
setOutAttributes()
Sets the outgoing attributes for the interpreter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean DEBUG
public static final java.lang.String INTERPRET
public static final java.lang.String INTERPRETER_TYPE
public static final java.lang.String INTERPRET_REPLY
public static final int DEFAULT_PORT
protected Attributes inAttributes
protected Attributes outAttributes
protected java.util.Hashtable inAttributeTypes
protected java.util.Hashtable outAttributeTypes
Constructor Detail |
public Interpreter(int port)
port
- Port number to create the BaseObject onBaseObject
Method Detail |
public java.lang.String getType()
getType
in class BaseObject
public DataObject runUserMethod(DataObject data)
runUserMethod
in class BaseObject
data
- DataObject containing the method to run and parameters
runInterpreterMethod(DataObject,String)
public DataObject callInterpreter(DataObject data, java.lang.String error)
data
- Incoming interpret requesterror
- Incoming error, if any
#interpretData(AttributeNameValues)
protected abstract Attributes interpretData(Attributes data)
data
- AttributeNameValues containing data to be interpreted
protected DataObject runInterpreterMethod(DataObject data, java.lang.String error)
data
- DataObject containing the data for the methoderror
- String containing the incoming error value
protected java.lang.String getInAttributeType(java.lang.String name)
name
- Name of the attribute to getprotected void setInAttribute(java.lang.String name, java.lang.String type)
name
- Name of the attribute to settype
- Type of the attributeprotected boolean isInAttribute(java.lang.String name)
name
- Name of the attribute to checkprotected java.lang.String getOutAttributeType(java.lang.String name)
name
- Name of the attribute to getprotected void setOutAttribute(java.lang.String name, java.lang.String type)
name
- Name of the attribute to settype
- Type of the attributeprotected boolean isOutAttribute(java.lang.String name)
name
- Name of the attribute to checkprotected abstract Attributes setInAttributes()
protected abstract Attributes setOutAttributes()
public DataObject getUserDescription()
getUserDescription
in class BaseObject
Discoverer
public DataObject getInterpreterDescription()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |