|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread eu.semaine.components.Component
public class Component
The abstract base class for all components. Subclasses need to:
act()
and/or react(SEMAINEMessage)
to do something meaningful.
Nested Class Summary | |
---|---|
static class |
Component.State
States of components that can be reported to the system meta component. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected java.util.concurrent.BlockingQueue<Receiver> |
inputWaiting
|
protected boolean |
isInput
|
protected boolean |
isOutput
|
protected JMSLogger |
log
|
protected MetaMessenger |
meta
|
protected java.util.List<Receiver> |
receivers
|
protected java.util.List<Sender> |
senders
|
protected Component.State |
state
|
protected int |
waitingTime
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
protected |
Component(java.lang.String componentName)
Create a component with the given name. |
protected |
Component(java.lang.String componentName,
boolean isInput,
boolean isOutput)
Create a component with the given name. |
protected |
Component(java.lang.String componentName,
boolean isInput,
boolean isOutput,
java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword)
Create a component with the given name. |
protected |
Component(java.lang.String componentName,
java.lang.String jmsUrl,
java.lang.String jmsUser,
java.lang.String jmsPassword)
Create a component with the given name. |
Method Summary | |
---|---|
protected void |
act()
Proactive actions. |
protected void |
customStartIO()
Any custom startup code can go here. |
protected boolean |
exitRequested()
|
MetaMessenger |
getMeta()
Provide access to this component's meta messenger, e.g. to query the component for its time. |
protected boolean |
hasSystemJustBecomeReady()
Method that informs subclasses that the system has just become ready. |
void |
messageAvailableFrom(Receiver source)
Method called from the corresponding receiver thread, to notify us that a message is available. |
protected void |
react(SEMAINEMessage message)
Reactions to messages. |
void |
requestExit()
Ask this component to exit as soon as possible. |
void |
run()
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected boolean isInput
protected boolean isOutput
protected java.util.List<Receiver> receivers
protected java.util.List<Sender> senders
protected java.util.concurrent.BlockingQueue<Receiver> inputWaiting
protected JMSLogger log
protected Component.State state
protected MetaMessenger meta
protected int waitingTime
Constructor Detail |
---|
protected Component(java.lang.String componentName) throws JMSException
IOBase.IOBase(String)
.
componentName
- the component name as it is to be used throughout the system.
JMSException
- if the connection to the middleware cannot be establishedprotected Component(java.lang.String componentName, boolean isInput, boolean isOutput) throws JMSException
IOBase.IOBase(String)
.
componentName
- the component name as it is to be used throughout the system.isInput
- whether the component is an input componentisOutput
- whether the component is an output component
JMSException
- if the connection to the middleware cannot be establishedprotected Component(java.lang.String componentName, java.lang.String jmsUrl, java.lang.String jmsUser, java.lang.String jmsPassword) throws JMSException
componentName
- the component name as it is to be used throughout the system.jmsUrl
- the url where to contact the JMS serverjmsUser
- the username to use (can be null)jmsPassword
- the password to use (can be null)
JMSException
- if the connection to the middleware cannot be establishedprotected Component(java.lang.String componentName, boolean isInput, boolean isOutput, java.lang.String jmsUrl, java.lang.String jmsUser, java.lang.String jmsPassword) throws JMSException
componentName
- the component name as it is to be used throughout the system.isInput
- whether the component is an input componentisOutput
- whether the component is an output componentjmsUrl
- the url where to contact the JMS serverjmsUser
- the username to use (can be null)jmsPassword
- the password to use (can be null)
JMSException
- if the connection to the middleware cannot be establishedMethod Detail |
---|
public MetaMessenger getMeta()
public void messageAvailableFrom(Receiver source)
messageAvailableFrom
in interface SEMAINEMessageAvailableListener
source
- the receiver that has a message available.protected void customStartIO() throws java.lang.Exception
java.lang.Exception
- if anything goes wrong in the internal processing of the component.public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected boolean exitRequested()
public void requestExit()
protected boolean hasSystemJustBecomeReady()
act()
.
protected void act() throws java.lang.Exception
waitingTime
milliseconds if no messages arrive, and after every message processing.
This base implementation does nothing; subclasses should implement
suitable behaviour here.
JMSException
- if communication with the JMS server goes wrong.
java.lang.Exception
- if anything goes wrong in the internal processing of the component.protected void react(SEMAINEMessage message) throws java.lang.Exception
JMSException
- if communication with the JMS server goes wrong.
java.lang.Exception
- if anything goes wrong in the internal processing of the component.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |