|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoolbus.ToolBus
public class ToolBus
ToolBus implements the behaviour of one ToolBus.
Nested Class Summary | |
---|---|
protected static class |
ToolBus.ProcessInstanceIterator
Custom iterator class. |
Field Summary | |
---|---|
protected SocketConnectionHandler |
connectionHandler
|
private DirectConnectionHandler |
directConnectionHandler
|
protected MatchStore |
matchStore
|
protected int |
nerrors
|
private long |
nextTime
|
private java.io.PrintWriter |
out
|
protected int |
portNumber
|
private toolbus.util.collections.ConcurrentHashMap<java.lang.String,ProcessDefinition> |
procdefs
|
protected java.util.List<ProcessInstance> |
processes
|
private int |
processIdCounter
|
private java.lang.Object |
processLock
|
protected PropertyManager |
propertyManager
|
private boolean |
running
|
private java.lang.String[] |
scriptsNames
|
private java.lang.Object |
shutdownLock
|
private static int |
SHUTDOWNTIMEOUT
|
protected boolean |
shuttingDown
|
private long |
startTime
|
protected TBTermFactory |
tbfactory
|
private toolbus.util.collections.ConcurrentHashMap<java.lang.String,ToolDefinition> |
tooldefs
|
private IToolExecutorFactory |
toolExecutorFactory
|
private ToolInstanceManager |
toolInstanceManager
|
private boolean |
workHasArrived
|
Constructor Summary | |
---|---|
ToolBus(java.lang.String[] args)
Constructor with implicit PrintWriter |
|
ToolBus(java.lang.String[] args,
java.io.PrintWriter out)
Constructor with explicit PrintWriter |
|
ToolBus(java.lang.String[] args,
java.io.StringWriter out)
Constructor with explicit StringWriter |
Method Summary | |
---|---|
ProcessInstance |
addProcess(ProcessCall call)
Add a process (as ProcessCall); previous two will become obsolete. |
void |
addProcessDefinition(ProcessDefinition PD)
Add a process definition. |
void |
addToolDefinition(ToolDefinition TD)
Add a tool definition. |
private void |
calculateToolSignatures(java.util.List<Atom> atomSignature)
|
void |
clearErrorsAndWarnings()
|
void |
dumpPerformanceStats()
Gathers performance statistics and writes them to the console. |
void |
dumpUnhandledMessages()
Prints all unhandled messages and queued notes to stderr. |
void |
error(java.lang.String src,
java.lang.String msg)
|
void |
execute()
The ToolBus's main process loop. |
DirectConnectionHandler |
getDirectConnectionHandler()
|
(package private) static java.lang.String |
getHostName()
Networking functions |
java.lang.String[] |
getIncludedScripts()
|
MatchStore |
getMatchStore()
|
int |
getPort()
|
java.io.PrintWriter |
getPrintWriter()
Get current PrintWriter. |
ProcessDefinition |
getProcessDefinition(java.lang.String name,
int numberOfActuals)
Get a process definition by name. |
java.util.List<ProcessDefinition> |
getProcessDefinitions()
|
java.util.List<ProcessInstance> |
getProcesses()
Get the current list of processes. |
java.lang.String |
getProperty(java.lang.String p)
Getters and setters for global properties |
java.lang.String |
getProperty(java.lang.String p,
java.lang.String def)
|
long |
getRunTime()
|
TBTermFactory |
getTBTermFactory()
Get the ATermFactory used. |
ToolDefinition |
getToolDefinition(java.lang.String name)
Get a tool definition by name. |
java.util.List<ToolDefinition> |
getToolDefinitions()
|
IToolExecutorFactory |
getToolExecutorFactory()
|
ToolInstanceManager |
getToolInstanceManager()
|
void |
parsecup()
|
void |
parsecup1(java.util.HashSet<java.lang.String> includedFiles,
java.util.List<aterm.ATerm> toolbusProcessCalls,
java.lang.String filename)
Parse a Tscript from file and add definitions to this ToolBus. |
void |
prepare()
|
void |
setNextTime(long next)
Notifies the ToolBus that an atom with a delay on it, which could not be executed, has just been touched. |
void |
setProperty(java.lang.String key,
java.lang.String val)
|
void |
setToolExecutorFactory(IToolExecutorFactory toolExecutorFactory)
|
void |
showStatus()
Dumps the current state of all the processes in the ToolBus and the state of all the tools to stderr. |
void |
shutdown(aterm.ATerm msg)
Shutdown of this ToolBus. |
void |
waitTillShutdown()
|
void |
workArrived(ToolInstance toolInstance,
byte operation)
Notifies the ToolBus that work has arrived. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int SHUTDOWNTIMEOUT
protected final PropertyManager propertyManager
protected volatile int portNumber
protected final TBTermFactory tbfactory
protected final java.util.List<ProcessInstance> processes
private int processIdCounter
private final toolbus.util.collections.ConcurrentHashMap<java.lang.String,ProcessDefinition> procdefs
protected final MatchStore matchStore
private final toolbus.util.collections.ConcurrentHashMap<java.lang.String,ToolDefinition> tooldefs
private final ToolInstanceManager toolInstanceManager
private volatile IToolExecutorFactory toolExecutorFactory
protected volatile SocketConnectionHandler connectionHandler
private final DirectConnectionHandler directConnectionHandler
private final java.io.PrintWriter out
protected int nerrors
private long startTime
private long nextTime
protected volatile boolean shuttingDown
private volatile java.lang.String[] scriptsNames
private final java.lang.Object shutdownLock
private volatile boolean running
private final java.lang.Object processLock
private volatile boolean workHasArrived
Constructor Detail |
---|
public ToolBus(java.lang.String[] args, java.io.PrintWriter out)
ToolBusError
public ToolBus(java.lang.String[] args)
ToolBusError
public ToolBus(java.lang.String[] args, java.io.StringWriter out)
ToolBusError
Method Detail |
---|
public MatchStore getMatchStore()
public ToolInstanceManager getToolInstanceManager()
public void setToolExecutorFactory(IToolExecutorFactory toolExecutorFactory)
public IToolExecutorFactory getToolExecutorFactory()
public DirectConnectionHandler getDirectConnectionHandler()
public java.lang.String getProperty(java.lang.String p)
public java.lang.String getProperty(java.lang.String p, java.lang.String def)
public void setProperty(java.lang.String key, java.lang.String val)
static java.lang.String getHostName()
public int getPort()
public TBTermFactory getTBTermFactory()
public java.util.List<ProcessInstance> getProcesses()
public java.io.PrintWriter getPrintWriter()
public void error(java.lang.String src, java.lang.String msg)
public void clearErrorsAndWarnings()
public long getRunTime()
public void setNextTime(long next)
next
- The relative time in milliseconds that needs to elapse before the atom can be executed.public void parsecup1(java.util.HashSet<java.lang.String> includedFiles, java.util.List<aterm.ATerm> toolbusProcessCalls, java.lang.String filename) throws ToolBusException
ToolBusException
public void parsecup() throws ToolBusException
ToolBusException
public void addProcessDefinition(ProcessDefinition PD) throws ToolBusError
ToolBusError
public void addToolDefinition(ToolDefinition TD) throws ToolBusError
ToolBusError
public ToolDefinition getToolDefinition(java.lang.String name) throws ToolBusError
ToolBusError
public java.util.List<ToolDefinition> getToolDefinitions()
private void calculateToolSignatures(java.util.List<Atom> atomSignature)
public ProcessInstance addProcess(ProcessCall call) throws ToolBusException
ToolBusException
public java.util.List<ProcessDefinition> getProcessDefinitions()
public ProcessDefinition getProcessDefinition(java.lang.String name, int numberOfActuals) throws ToolBusError
numberOfActuals
- TODO
ToolBusError
public java.lang.String[] getIncludedScripts()
public void showStatus()
public void shutdown(aterm.ATerm msg)
public void dumpPerformanceStats()
public void dumpUnhandledMessages()
public void prepare()
public void execute()
public void workArrived(ToolInstance toolInstance, byte operation)
toolInstance
- The tool instance associated with the tool that send us data.operation
- The operation associated with the package that arrived.public void waitTillShutdown()
|
The Meta-Environment API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |