|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cafesip.jiplet.Jiplet
public class Jiplet
The Jiplet class is the base class that all Jiplet classes must extend. Jiplets are SIP server-side components. In concept, tt is similar to a Java servlet. A java servlet is a Java object that runs inside a servlet container and handles HTTP requests. Similarly, a jiplet is a Java object that runs inside a Jiplet Container and handles SIP requests. Application developers can create jiplets classes and add them to the Jiplet Container in a manner similar to how servlets are added into a servlet container. To create a jiplet, a new jiplet class must be created that extends this class. To add the custom business logic, the class must overide one or more of the public methods of the Jiplet class. The processRequest(), processResponse(), processTimeout() and processTimers() are the "low-level" methods that are invoked by the jiplet container when a SIP request, response or timeout is received or when a application timer expires. A jiplet can override these methods to provide custom logic. Alternatively, override one of the do...() methods to provide handling for specific requests. The container calls the init() method when the jiplet is initialized. A jiplet class can override this method to provide custom initialization logic. Similarly, the destory() method can be overidden to provide custom logic when the jiplet is removed from service. To integrate logging with that of the container, the debug(), info(), warn(), error(), and fatal() methods are provided. Jiplets can call these methods to print log messages.
| Constructor Summary | |
|---|---|
Jiplet()
|
|
| Method Summary | |
|---|---|
void |
cancelResponse(JipletTransaction transaction)
This method is used to notify the jiplet container that the response is no longer expected. |
void |
cancelTimer(TimerEvent timer)
This method cancels a timer started by the startTimer() methods. |
void |
debug(java.lang.String message)
This method is used to print a debug message into the jiplet containers logs. |
void |
destroy()
This method is called by the jiplet container when the jiplet is being taken out of service or when the context or the container is being shutdown. |
void |
doAck(JipletRequest request)
This method is invoked by the container when a SIP request message of the type ACK is received. |
void |
doBye(JipletRequest request)
This method is invoked by the container when a SIP request message of the type BYE is received. |
void |
doCancel(JipletRequest request)
This method is invoked by the container when a SIP request message of the type CANCEL is received. |
void |
doExtension(JipletRequest request)
This method is invoked by the container when a SIP request message is received that is neither REGISTER, INVITE, ACK, BYE, CANCEL, INFO, MESSAGE, NOTIFY, OPTIONS, PRACK, REFER, SUBSCRIBE OR UPDATE. |
void |
doInfo(JipletRequest request)
This method is invoked by the container when a SIP request message of the type INFO is received. |
void |
doInvite(JipletRequest request)
This method is invoked by the container when a SIP request message of the type INVITE is received. |
void |
doMessage(JipletRequest request)
This method is invoked by the container when a SIP request message of the type MESSAGE is received. |
void |
doNotify(JipletRequest request)
This method is invoked by the container when a SIP request message of the type NOTIFY is received. |
void |
doOptions(JipletRequest request)
This method is invoked by the container when a SIP request message of the type OPTIONS is received. |
void |
doPrack(JipletRequest request)
This method is invoked by the container when a SIP request message of the type PRACK is received. |
void |
doRegister(JipletRequest request)
This method is invoked by the container when a SIP request message of the type REGISTER is received. |
void |
doSubscribe(JipletRequest request)
This method is invoked by the container when a SIP request message of the type SUBSCRIBE is received. |
void |
doUpdate(JipletRequest request)
This method is invoked by the container when a SIP request message of the type UPDATE is received. |
void |
error(java.lang.String message)
This method is used to print an error message into the jiplet containers logs. |
void |
fatal(java.lang.String message)
This method is used to print a fatal message into the jiplet containers logs. |
void |
forward(JipletEvent event,
java.lang.String jiplet)
A jiplet can forward a request, response, timeout or a timer expiry event to another jiplet. |
javax.sip.address.AddressFactory |
getAddressFactory()
This method returns the JAIN-SIP AddressFactory object which can then be user to format SIP messages. |
protected java.lang.String |
getConnectorName()
Gets the connector name associated with this jiplet. |
JipConnector |
getConnectorProperty()
Gets the property of the connector to which this jiplet object is attached to. |
java.lang.String |
getDescription()
This method returns the description of the jiplet. |
JipletDialog |
getDialog(javax.sip.Dialog dialog,
boolean create)
This method is used to get a JipletDialog object. |
javax.sip.header.HeaderFactory |
getHeaderFactory()
This method returns the JAIN-SIP HeaderFactory object which can then be user to format SIP messages. |
protected java.util.HashMap |
getInitParams()
Returns the init paramters that has been specified in the jip.xml file. |
JipletContext |
getJipletContext()
This method returns the context. |
javax.sip.ListeningPoint |
getListeningPointDefault()
Returns the JAIN-SIP listening point that has been designated as the default listening point for this jiplet's SIP connector. |
java.util.ArrayList |
getListeningPoints()
Returns all of the JAIN-SIP listening points that have been configured for this jiplet's SIP connector. |
javax.sip.message.MessageFactory |
getMessageFactory()
This method returns the JAIN-SIP MessageFactory object which can then be user to format SIP messages. |
java.lang.String |
getName()
Returns the name of the jiplet. |
javax.sip.SipProvider |
getSipProvider(javax.sip.ListeningPoint lp)
Returns the JAIN-SIP SIP provider corresponding to the given listening point. |
javax.sip.SipProvider |
getSipProvider(java.lang.String address,
int port)
Returns the JAIN-SIP SIP provider associated with the given host address and port. |
boolean |
hasAddress(java.lang.String host,
int port)
Indicates if this jiplet's SIP connector is handling (owns) the given host/port or not. |
void |
info(java.lang.String message)
This method is used to print an informational message into the jiplet containers logs. |
void |
init(JipletConfig config)
The init() method is called by the jiplet container when the jiplet is being initialized. |
boolean |
isDebugEnabled()
The debug is a flag that indicates whether the container is is "debug" mode. |
void |
processRequest(JipletRequest request)
This method is invoked by the container when a SIP request message is received that matches the selection criteria for the jiplet. |
void |
processResponse(JipletResponse response)
This method is invoked by the container when a SIP response message is received. |
void |
processSignal(JipletSignal signal)
This method is called by the jiplet container to notify the jiplet of an event (signal) from an external entity. |
void |
processTimeout(JipletTimeout timeout)
This method is invoked by the container when a SIP time-out event occurs. |
void |
processTimer(JipletTimer timer)
A jiplet may start timers by calling the method startTimer(). |
JipletTransaction |
registerForResponse(javax.sip.message.Request request)
This method is similar to the registerForResponse(Request request, long timeout) except that it does not have a timeout parameter. |
JipletTransaction |
registerForResponse(javax.sip.message.Request request,
long timeout)
This method is used by the server to register for a SIP response message. |
void |
setAddressFactory(javax.sip.address.AddressFactory addressFactory)
|
protected void |
setConnector(SipConnector connector)
|
void |
setDescription(java.lang.String description)
|
void |
setHeaderFactory(javax.sip.header.HeaderFactory headerFactory)
|
protected void |
setInitParams(java.util.HashMap initParams)
|
void |
setJipletContext(JipletContext jipletContext)
|
void |
setMessageFactory(javax.sip.message.MessageFactory messageFactory)
|
void |
setName(java.lang.String name)
|
TimerEvent |
startTimer(java.util.Date time,
JipletEvent event,
java.lang.Object param)
Similar to the startTimer(long delay, boolean repeat, JipletEvent event, Object param) method. |
TimerEvent |
startTimer(java.util.Date firstTime,
long period,
JipletEvent event,
java.lang.Object param)
Similar to the startTimer(Date time, JipletEvent event, Object param) method. |
TimerEvent |
startTimer(long delay,
boolean repeat,
JipletEvent event,
java.lang.Object param)
This method is used to start a timer. |
TimerEvent |
startTimer(long delay,
JipletEvent event,
java.lang.Object param)
Similar to the startTimer(long delay, boolean repeat, JipletEvent event, Object param) method. |
java.lang.String |
toString()
|
void |
warn(java.lang.String message)
This method is used to print a warning message into the jiplet containers logs. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Jiplet()
| Method Detail |
|---|
public JipletContext getJipletContext()
public void setJipletContext(JipletContext jipletContext)
jipletContext - The jipletContext to set.
public void init(JipletConfig config)
throws JipletException
config - object containing the jiplet configuration. The jiplet
configuration is specified in the file
context.JIP-INF/jip.xml.
JipletExceptionpublic void destroy()
public final java.lang.String getName()
public final java.lang.String getDescription()
public void processRequest(JipletRequest request)
request - the request object.public void doExtension(JipletRequest request)
request - request object.public void doUpdate(JipletRequest request)
request - request object.public void doSubscribe(JipletRequest request)
request - request object.public void doPrack(JipletRequest request)
request - request object.public void doOptions(JipletRequest request)
request - request object.public void doNotify(JipletRequest request)
request - request object.public void doMessage(JipletRequest request)
request - request object.public void doInfo(JipletRequest request)
request - request object.public void doCancel(JipletRequest request)
request - request object.public void doBye(JipletRequest request)
request - request object.public void doAck(JipletRequest request)
request - request object.public void doInvite(JipletRequest request)
request - request object.public void doRegister(JipletRequest request)
request - request object.public void processResponse(JipletResponse response)
response - response object.public void processTimeout(JipletTimeout timeout)
timeout - timeout object.public void processTimer(JipletTimer timer)
timer - The timer object.public final void setDescription(java.lang.String description)
description - The description to set.public final void setName(java.lang.String name)
name - The name to set.public final javax.sip.address.AddressFactory getAddressFactory()
public final void setAddressFactory(javax.sip.address.AddressFactory addressFactory)
addressFactory - The addressFactory to set.public final javax.sip.header.HeaderFactory getHeaderFactory()
public final void setHeaderFactory(javax.sip.header.HeaderFactory headerFactory)
headerFactory - The headerFactory to set.public final javax.sip.message.MessageFactory getMessageFactory()
public final void setMessageFactory(javax.sip.message.MessageFactory messageFactory)
messageFactory - The messageFactory to set.public final void info(java.lang.String message)
message - message to printpublic final void warn(java.lang.String message)
message - message to printpublic final void error(java.lang.String message)
message - message to printpublic final void fatal(java.lang.String message)
message - message to printpublic final void debug(java.lang.String message)
message - message to printpublic final boolean isDebugEnabled()
public final void forward(JipletEvent event,
java.lang.String jiplet)
event - the event object (passed on as a parameter to the process..()
or do...() methods).jiplet - the jiplet object to forward the event to.
public final TimerEvent startTimer(long delay,
boolean repeat,
JipletEvent event,
java.lang.Object param)
delay - the duration of the timer in milliseconds.repeat - true if the timer is to be repeated.event - the request/response/timeout/timer object that was received as
a parameter for the process...() or do...() methods.param - An object that the jiplet can specify. This object is returned
when the timer expires as a part of the timer object in the
processTimer() request.
public final TimerEvent startTimer(long delay,
JipletEvent event,
java.lang.Object param)
delay - event - param -
public final TimerEvent startTimer(java.util.Date time,
JipletEvent event,
java.lang.Object param)
time - the absolute time when the timer expires.event - param -
public final TimerEvent startTimer(java.util.Date firstTime,
long period,
JipletEvent event,
java.lang.Object param)
firstTime - the absolute time when the timer expires for the first time.period - of time in milliseconds after which the timer expires
periodically.event - param -
public final void cancelTimer(TimerEvent timer)
timer - the object returned by the startTimer() method.protected final void setConnector(SipConnector connector)
connector - The connector to set.protected final java.lang.String getConnectorName()
public final javax.sip.ListeningPoint getListeningPointDefault()
public final javax.sip.SipProvider getSipProvider(javax.sip.ListeningPoint lp)
lp - The javax.sip.ListeningPoint.
public final javax.sip.SipProvider getSipProvider(java.lang.String address,
int port)
address - The host address known by the caller.port - The port known by the caller.
public final java.util.ArrayList getListeningPoints()
public final boolean hasAddress(java.lang.String host,
int port)
host - The host address.port - The port number.
public final JipConnector getConnectorProperty()
protected final java.util.HashMap getInitParams()
protected final void setInitParams(java.util.HashMap initParams)
initParams - The initParams to set.
public final JipletDialog getDialog(javax.sip.Dialog dialog,
boolean create)
Note that the Jiplet Container uses the JAIN-SIP dialog's application data object for stroring the dialog scope variables. Therefore, the jiplet application must not use the application data.
dialog - the JAIN-SIP dialog objectcreate - true if the JipletDialog object is to be created if it does
not exist.
public final JipletTransaction registerForResponse(javax.sip.message.Request request,
long timeout)
request - JAIN-SIP request message objecttimeout - Timeout duration in millisconds for the response to be
received.
public final JipletTransaction registerForResponse(javax.sip.message.Request request)
request -
public final void cancelResponse(JipletTransaction transaction)
transaction - the transaction id returned by the registerForResponse()
methods.public final java.lang.String toString()
toString in class java.lang.Objectpublic void processSignal(JipletSignal signal)
signal - contains more detailed information on the signal.JipletSignal
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||