|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoolbus.adapter.ToolBridge
public abstract class ToolBridge
This class supplies an interface for the tool towards the ToolBus and handles the invokation of methods on the tool.
Nested Class Summary | |
---|---|
private static class |
ToolBridge.Job
A job. |
private class |
ToolBridge.JobQueue
This job queue holds all the jobs that are send from a single source. |
private class |
ToolBridge.ThreadLocalJobQueue
This job queue holds all the jobs that are posted by a certain thread. |
private static class |
ToolBridge.WorkerQueue
The queue that is meant to take care of the asynchroneous execution and queueing of anything that invokes stuff on a tool. |
Field Summary | |
---|---|
private java.net.InetAddress |
host
|
private IIOHandler |
ioHandler
|
private int |
port
|
private java.util.Map<java.lang.String,ToolBridge.JobQueue> |
queues
|
private aterm.pure.PureFactory |
termFactory
|
private java.util.Map<java.lang.Long,ToolBridge.ThreadLocalJobQueue> |
threadLocalQueues
|
private ToolBus |
toolbus
|
private int |
toolID
|
private java.lang.String |
toolName
|
private java.lang.String |
type
|
private ToolBridge.WorkerQueue |
workerQueue
|
Fields inherited from interface toolbus.IOperations |
---|
ACKDO, ACKEVENT, CONNECT, DEBUGPERFORMANCESTATS, DISCONNECT, DO, END, EVAL, EVENT, PERFORMANCESTATS, REQUEST, RESPONSE, TERMINATE, UNDEFINED, VALUE |
Constructor Summary | |
---|---|
ToolBridge(aterm.pure.PureFactory termFactory,
java.lang.String toolName,
int toolID,
java.net.InetAddress host,
int port)
Constructor. |
|
ToolBridge(aterm.pure.PureFactory termFactory,
java.lang.String toolName,
int toolID,
ToolBus toolbus)
Constructor. |
Method Summary | |
---|---|
abstract boolean |
checkSignature(aterm.ATerm signature)
Checks if the tool associated with this tool bridge supplies the given signature. |
abstract void |
doDo(aterm.ATerm aTerm)
Executes a DO operation with the given ATerm. |
abstract aterm.ATerm |
doEval(aterm.ATerm aTerm)
Executes an EVAL operation with the given ATerm. |
abstract aterm.ATerm |
doGetPerformanceStats()
Retrieves performance statistic information from the tool (if possible). |
abstract void |
doReceiveAckEvent(aterm.ATerm aTerm)
Executes a RECACKEVENT operation with the given ATerm. |
abstract void |
doTerminate(aterm.ATerm aTerm)
Executes a TERMINATE operation with the given ATerm. |
void |
exceptionOccured()
Notifies the data handler that an exception has occured so it can take the necessary steps. |
aterm.pure.PureFactory |
getFactory()
Returns a reference to the term factory. |
protected java.net.InetAddress |
getHost()
Returns the adress of the host the ToolBus is running on. |
protected int |
getPort()
Returns the port number the ToolBus is running on. |
int |
getToolID()
Returns the tool id of the tool that is associated with this tool bridge. |
java.lang.String |
getToolName()
Returns the tool name of the tool that is associated with this tool bridge. |
java.lang.String |
getType()
Returns what type of connection we have with the ToolBus. |
void |
postEvent(aterm.ATerm aTerm)
Posts the given event. |
aterm.ATermAppl |
postRequest(aterm.ATerm aTerm)
Posts the given request. |
void |
receive(byte operation,
aterm.ATerm aTerm)
Receives a term from the associated ioHandler. |
void |
run()
Executes the ToolBridge. |
void |
send(byte operation,
aterm.ATerm aTerm)
Forwards a term to the associated ioHandler. |
void |
setIOHandler(IIOHandler ioHandler)
Associates an I/O handler with this tool bridge. |
protected void |
setToolID(int toolID)
Sets the tool id to the given values. |
void |
shutDown()
Informs the tool that it was shut down by the toolbus. |
void |
terminate()
Requests the termination of this tool, so it can perform an orderly shutdown on the toolbus side. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final aterm.pure.PureFactory termFactory
private final java.util.Map<java.lang.Long,ToolBridge.ThreadLocalJobQueue> threadLocalQueues
private final java.util.Map<java.lang.String,ToolBridge.JobQueue> queues
private final ToolBridge.WorkerQueue workerQueue
private volatile IIOHandler ioHandler
private final java.lang.String type
private final java.lang.String toolName
private int toolID
private final java.net.InetAddress host
private final int port
private final ToolBus toolbus
Constructor Detail |
---|
public ToolBridge(aterm.pure.PureFactory termFactory, java.lang.String toolName, int toolID, java.net.InetAddress host, int port)
termFactory
- The term factory to use.toolName
- The name of the with this bridge associated tool.toolID
- The id of the with this bridge associated tool.host
- The host on which the ToolBus is running.port
- The port on which the ToolBus is running.public ToolBridge(aterm.pure.PureFactory termFactory, java.lang.String toolName, int toolID, ToolBus toolbus)
termFactory
- The term factory to use.toolName
- The name of the with this bridge associated tool.toolID
- The id of the with this bridge associated tool.toolbus
- The toolbus to connect to.Method Detail |
---|
public java.lang.String getType()
public java.lang.String getToolName()
protected void setToolID(int toolID)
toolID
- The value the toolID has to be set too.public int getToolID()
public aterm.pure.PureFactory getFactory()
protected java.net.InetAddress getHost()
protected int getPort()
public void setIOHandler(IIOHandler ioHandler)
setIOHandler
in interface IDataHandler
ioHandler
- The I/O handler to associate this tool bridge with.public abstract boolean checkSignature(aterm.ATerm signature)
signatures
- The signature we need to compare the interface of the tool too.
public abstract void doDo(aterm.ATerm aTerm)
aTerm
- The ATerm that contains the necessary data to complete the DO request.public abstract aterm.ATerm doEval(aterm.ATerm aTerm)
aTerm
- The ATerm that contains the necessary data to complete the EVAL request.
public abstract void doReceiveAckEvent(aterm.ATerm aTerm)
aTerm
- The ATerm that can potentially contain callback data.public abstract void doTerminate(aterm.ATerm aTerm)
aTerm
- The ATerm that can potentially contain background informantion about the termination request.public abstract aterm.ATerm doGetPerformanceStats()
public void send(byte operation, aterm.ATerm aTerm)
IDataHandler
send
in interface IDataHandler
operation
- The operation associated with the term we need to send.aTerm
- The term that needs to be transmitted.IDataHandler.send(byte, ATerm)
public void postEvent(aterm.ATerm aTerm)
aTerm
- The event.public aterm.ATermAppl postRequest(aterm.ATerm aTerm)
aTerm
- The request.public void receive(byte operation, aterm.ATerm aTerm)
IDataHandler
receive
in interface IDataHandler
operation
- The operation associate with the term we received.aTerm
- The term that was received.IDataHandler.receive(byte, ATerm)
public void terminate()
terminate
in interface IDataHandler
IDataHandler.terminate()
public void shutDown()
shutDown
in interface IDataHandler
IDataHandler.shutDown()
public void exceptionOccured()
IDataHandler
exceptionOccured
in interface IDataHandler
IDataHandler.exceptionOccured()
public void run()
run
in interface java.lang.Runnable
Runnable.run()
|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |