org.cafesip.jiplet
Class JipletSignal

java.lang.Object
  extended by org.cafesip.jiplet.ScopedVariables
      extended by org.cafesip.jiplet.JipletEvent
          extended by org.cafesip.jiplet.JipletSignal

public class JipletSignal
extends JipletEvent

This class is used by jiplets to retrieve information about a signal it has received. External entities can interact with the jiplet by sending a "signal". A signal encapsulates any event that an external entity can send. For example, an external entity may send a message to the jiplet using a socket. If the jiplet has been programmed to receive the message, it can be received by the jiplet.

The way it works is that in the init() or any other method in the jiplet, you must initialize your connection to the external entity and create a listener for external event. For example, If your jiplet wants to receive a message from a UDP socket, you should initialize the open the socket connection and create a thread from where you can listen to the socket. When a message arrives, your listener must call the org.cafesip.jiplet.JipletContext.sendSignal() message to pass on the message to the jiplet.

The jiplet container allocates a thread from the thread pool and calls the processSignal() method of the jiplet to deliver the message. The jiplet has access to the scoped variables and can also forward the event from one jiplet to another using standard mechanisms laid out by the jiplet container.


Constructor Summary
JipletSignal()
          A constructor for this class.
 
Method Summary
 java.lang.Object getEventObject()
           
 Jiplet getJiplet()
           
 javax.sip.message.Message getMessage()
           
 JipletSession getSession(boolean create)
          Get the session object associated with this event.
 void setEventObject(java.lang.Object eventObject)
          The code calling the JipletContext.sendSignal() method to signal an event can pass any object to the jiplet by calling this setter method.
protected  void setJiplet(Jiplet jiplet)
           
 void setMessage(javax.sip.message.Message message)
          The code calling the JipletContext.sendSignal() method to signal an asscoiated SIP message.
 
Methods inherited from class org.cafesip.jiplet.JipletEvent
getForward, getJipletContext, getSession, setForward, setJipletContext
 
Methods inherited from class org.cafesip.jiplet.ScopedVariables
getAttribute, getAttributeNames, removeAttribute, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JipletSignal

public JipletSignal()
A constructor for this class.

Method Detail

getEventObject

public java.lang.Object getEventObject()
Returns:
Returns the eventObject.

setEventObject

public void setEventObject(java.lang.Object eventObject)
The code calling the JipletContext.sendSignal() method to signal an event can pass any object to the jiplet by calling this setter method. The Object can be retrieved by the jiplet by calling the getter method. You can use this method to pass any object to the jiplet. For example, if you want to send a UDP message that is received by your application, you can pass the datagram object using this method.

Parameters:
eventObject - The eventObject to set.

getMessage

public javax.sip.message.Message getMessage()
Returns:
Returns the message.

setMessage

public void setMessage(javax.sip.message.Message message)
The code calling the JipletContext.sendSignal() method to signal an asscoiated SIP message. The message can be used by the jiplet to access the session-scope variables or it can be retrieved by the jiplet by calling the getter method.

Parameters:
message - The message to set.

getSession

public JipletSession getSession(boolean create)
Get the session object associated with this event. A session identifies the SIP endpoint (UAC). Session-scope variables are supported similar to servlets and this object is used for storing session-scope variables.

Parameters:
create - create the session object if it does not exist.
Returns:
the session object. Null if the create parameter is false and the session object does not exist.

getJiplet

public Jiplet getJiplet()
Returns:
Returns the jiplet.

setJiplet

protected void setJiplet(Jiplet jiplet)
Parameters:
jiplet - The jiplet to set.


http://www.cafesip.org