Actuator
Class Actuator

java.lang.Object
  extended by Actuator.Actuator
All Implemented Interfaces:
IMessageCompose, IMetaOperations, IParseOperations
Direct Known Subclasses:
MessageActuator, XMLMessageActuator

public abstract class Actuator
extends java.lang.Object
implements IMessageCompose, IMetaOperations, IParseOperations

Actuator is the base abstract class that is extended to specialized message actuators e.g. the binary, text and XML actuators.

Author:
Paul Grace, Lancaster University, UK

Field Summary
protected  java.lang.String DSLContent
           
protected  Parser Parser
           
protected  ParserFramework parsingOperations
           
 
Constructor Summary
Actuator(java.lang.String File)
           
 
Method Summary
 void addFunction(java.lang.String functionName, java.lang.Class HostClass, java.lang.Object HostObject)
           
 void addParseOperation(java.lang.String dataType, java.lang.Class HostClass, java.lang.Object HostObject)
          Add a new parsing operation to those provided by the object implementing this interface.
 java.lang.Object composeTypedValue(java.lang.String dataType, java.lang.Object dataValue, int size)
          Composes the representation of the data type to be used in the message format.
 java.lang.Object decode(java.lang.String name, java.lang.Object data)
           
 java.lang.Object getConstantValue(java.lang.String type, java.lang.String constant)
           
 java.lang.Object getFunctionResult(java.lang.String function)
           
 java.lang.Object getFunctionResult(java.lang.String function, java.lang.Object parameter)
           
 java.lang.Object getTextTypedValue(java.lang.String dataType, java.lang.Object dataValue)
           
 java.lang.Object getTypedValue(java.lang.String dataType, java.lang.Object dataValue)
          Convert the data in the dataValue parameter into a Java object that matches the dataType provided.
 java.lang.String[] inspectFunctions()
           
 java.lang.String[] inspectParseOperations()
           
 void removeFunction(java.lang.String functionName)
           
 void removeParseOperation(java.lang.String dataType)
          Remove a deployed parsing operation.
 byte[] toByteArray(java.util.BitSet bits)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Actuator.IMessageCompose
MessageCompose
 

Field Detail

parsingOperations

protected ParserFramework parsingOperations

Parser

protected Parser Parser

DSLContent

protected java.lang.String DSLContent
Constructor Detail

Actuator

public Actuator(java.lang.String File)
Method Detail

addParseOperation

public void addParseOperation(java.lang.String dataType,
                              java.lang.Class HostClass,
                              java.lang.Object HostObject)
Add a new parsing operation to those provided by the object implementing this interface. That is, dynamically extend the number of types that the getTypedValue can understand.

Specified by:
addParseOperation in interface IMetaOperations
Parameters:
dataType - The type of object that the operation reads/parses
HostClass - The class of the object where the operation is hosted
HostObject - The object where the operation is hosted

removeParseOperation

public void removeParseOperation(java.lang.String dataType)
Description copied from interface: IMetaOperations
Remove a deployed parsing operation.

Specified by:
removeParseOperation in interface IMetaOperations
Parameters:
dataType - The type of object that the operation reads/parses

addFunction

public void addFunction(java.lang.String functionName,
                        java.lang.Class HostClass,
                        java.lang.Object HostObject)
Specified by:
addFunction in interface IMetaOperations

removeFunction

public void removeFunction(java.lang.String functionName)
Specified by:
removeFunction in interface IMetaOperations

inspectParseOperations

public java.lang.String[] inspectParseOperations()
Specified by:
inspectParseOperations in interface IMetaOperations

inspectFunctions

public java.lang.String[] inspectFunctions()
Specified by:
inspectFunctions in interface IMetaOperations

getTypedValue

public java.lang.Object getTypedValue(java.lang.String dataType,
                                      java.lang.Object dataValue)
                               throws TypeNotFoundException
Description copied from interface: IParseOperations
Convert the data in the dataValue parameter into a Java object that matches the dataType provided.

Specified by:
getTypedValue in interface IParseOperations
Parameters:
dataType - Required type to be produced
dataValue - The raw data to be parsed
Returns:
A Java of type dataType with the value held in dataValue
Throws:
TypeNotFoundException

getTextTypedValue

public java.lang.Object getTextTypedValue(java.lang.String dataType,
                                          java.lang.Object dataValue)
                                   throws TypeNotFoundException
Specified by:
getTextTypedValue in interface IParseOperations
Throws:
TypeNotFoundException

composeTypedValue

public java.lang.Object composeTypedValue(java.lang.String dataType,
                                          java.lang.Object dataValue,
                                          int size)
                                   throws TypeNotFoundException
Description copied from interface: IParseOperations
Composes the representation of the data type to be used in the message format.

Specified by:
composeTypedValue in interface IParseOperations
Parameters:
dataType - Required type to be composed
dataValue - The current object value to be marshalled
size - The length of the data to be created e.g. (2 byte for int)
Returns:
The marshalled result which will typically be a byte array
Throws:
TypeNotFoundException

getConstantValue

public java.lang.Object getConstantValue(java.lang.String type,
                                         java.lang.String constant)
Specified by:
getConstantValue in interface IParseOperations

getFunctionResult

public java.lang.Object getFunctionResult(java.lang.String function,
                                          java.lang.Object parameter)
Specified by:
getFunctionResult in interface IParseOperations

getFunctionResult

public java.lang.Object getFunctionResult(java.lang.String function)
Specified by:
getFunctionResult in interface IParseOperations

decode

public java.lang.Object decode(java.lang.String name,
                               java.lang.Object data)
Specified by:
decode in interface IParseOperations

toByteArray

public byte[] toByteArray(java.util.BitSet bits)
Specified by:
toByteArray in interface IParseOperations