|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The execution context of an egg. This class mainly provides a set of methods that are useful during the handling of a message.
Method Summary | |
void |
bindToPort(Port p)
Bind this egg to the specified port which belongs to another egg. |
Message |
createMessage(java.lang.Object m)
Create a message at the default priority that is ready to be directly written to a message port. |
Message |
createMessage(java.lang.Object m,
Priority p)
Create a message at the specified priority that is ready to be directly written to a message port. |
Timer |
createRepeatingTimer(long interval_msec,
long delay_msec)
Create a timer that will periodically send timeout messages to this egg. |
Timer |
createSingleShotTimer(long delay_msec)
Create a timer that will send a single timeout message to this egg. |
Message |
getCurrentMessage()
Return the message wrapper of the application message that is currently being handled. |
Dispatcher |
getDispatcher()
Return the dispatcher that this egg is assigned to. |
Port |
getFromPort()
Return the port of the egg that sent the application message that is currently being handled. |
java.lang.Object |
getId()
Return the ID of this egg as assigned to it in the application descriptor. |
java.lang.Class[] |
getInterface()
Return the set of message types that this egg recognizes. |
Port |
getPort()
Return this egg's message port. |
Property[] |
getProperties()
Return all of the properties configured on this egg in the application descriptor. |
java.lang.String |
getProperty(java.lang.String key)
Return a property configured on this egg in the application descriptor. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defValue)
Return a property configured on this egg in the application descriptor. |
void |
publishPort(java.lang.String n)
Publish this egg's message port in the JEgg framework registry. |
void |
requestPort(java.lang.String n)
Request a lookup of a message port in the JEgg framework registry. |
void |
respond(java.lang.Object message)
Send a message to the egg that sent the current message. |
void |
respond(java.lang.Object message,
Priority priority)
Send a message to the egg that sent the current message. |
void |
respond(Port port,
java.lang.Object message)
Send a message to the egg that the specified port belongs to. |
void |
respond(Port port,
java.lang.Object message,
Priority priority)
Send a message to the egg that the specified port belongs to. |
void |
send(java.lang.Object msg)
Broadcast a message to all eggs that have bound to this egg's port (see bindToPort ). |
Method Detail |
public java.lang.String getProperty(java.lang.String key)
key
- the name of the property.
public java.lang.String getProperty(java.lang.String key, java.lang.String defValue)
key
- the name of the property.defValue
- the value to return if the property can't be found.
public Property[] getProperties()
public void bindToPort(Port p)
p
- the port to bind to in order to receive all broadcast
message from the egg that owns the port.public Message createMessage(java.lang.Object m)
send
method accepts the object message to send and
internally wraps it in a message instance.
m
- the application message to wrap.
public Message createMessage(java.lang.Object m, Priority p)
m
- the application message to wrap.p
- the priority to assign to the message.
public Timer createRepeatingTimer(long interval_msec, long delay_msec)
interval_msec
- the interval, in milliseconds, at which the
timeout messages should be sent.delay_msec
- the initial delay, in milliseconds, before the first timeout should
be sent.
public Timer createSingleShotTimer(long delay_msec)
delay_msec
- the initial delay, in milliseconds, before the timeout is sent.
public Message getCurrentMessage()
public Dispatcher getDispatcher()
public Port getFromPort()
public java.lang.Object getId()
public java.lang.Class[] getInterface()
public Port getPort()
public void publishPort(java.lang.String n)
n
- the name that the message port should be published under.public void requestPort(java.lang.String n)
n
- the name that the requested port is expected to be registered
under.public void respond(java.lang.Object message)
message
- the message to send to the sending egg.public void respond(java.lang.Object message, Priority priority)
message
- the message to send to the sending egg.priority
- the priority to assign to the message.public void respond(Port port, java.lang.Object message)
port
- the port to send the message on.message
- the message to send to the egg that
the specified port belongs to.public void respond(Port port, java.lang.Object message, Priority priority)
port
- the port to send the message on.message
- the message to send to the egg that
the specified port belongs to.priority
- the message's priority assignment.public void send(java.lang.Object msg)
bindToPort
).
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |