A SLEE resource adaptor type (RA Type) is a specification of the SLEE activities, events and interfaces that a resource adaptor (RA) implements. Rhino SIP Servlet includes an RA type for the SIP Servlet 1.1 API, which adapts the SIP Servlet API for use by SLEE applications.
|
|
Developers of pure SIP Servlet applications may skip this section, as the Container services hides these details from SIP Servlet applications. This section is useful to those developing Hybrid Applications (SLEE applications directly on top of the SIP Servlet RA type). |
Activities
The SIP Servlet RA type defines SIP Servlet SipApplicationSession and SipSession objects as SLEE activities. This means that SBBs may attach to them, use CMP attributes on their activity context interfaces, set timers, or use the Activity Context Naming Facility.
SipApplicationSession
The SIP Servlet creates SipApplicationSession activities automatically when it receives a new initial request for an application. An application can also create a new SipApplicationSession using SipFactory.createApplicationSession().
The SipApplicationSession activity ends when the session becomes invalidated in SIP Servlet 1.1, by:
-
calling
SipApplicationSession.invalidate() -
session expiration
-
invalidate-when-readyis enabled and allSipSessionsare ready to invalidate.
SipSession
The SIP Servlet RA type creates SipSession activities when it receives new requests, or when an application sends an outgoing request using the SipFactory.createRequest() methods.
SipSession activities end when the session becomes invalidated in SIP Servlet 1.1, by:
-
calling
SipSession.invalidate() -
session expiration
-
invalidate-when-ready is enabled and the
SipSessionis ready to invalidate (for example, adialog-endingrequest has been sent or received).
Events
The SIP Servlet RA Type defines events that correspond to SIP Servlet’s request-and-response callbacks, and also several listener events — summarized below.
EventTypeID (Name, Vendor, Version)SIP Servlet equivalent |
DescriptionClass |
|---|---|
javax.servlet.sip.SipServletRequest.INVITE, OpenCloud, 1.1
|
An INVITE request was received. |
javax.servlet.sip.SipServletRequest.ACK, OpenCloud, 1.1
|
An ACK request was received. |
javax.servlet.sip.SipServletRequest.CANCEL, OpenCloud, 1.1
|
A CANCEL request was received. |
javax.servlet.sip.SipServletRequest.BYE, OpenCloud, 1.1
|
A BYE request was received. |
javax.servlet.sip.SipServletRequest.OPTIONS, OpenCloud, 1.1
|
An OPTIONS request was received. |
javax.servlet.sip.SipServletRequest.REGISTER, OpenCloud, 1.1
|
A REGISTER request was received. |
javax.servlet.sip.SipServletRequest.INFO, OpenCloud, 1.1
|
An INFO request was received. |
javax.servlet.sip.SipServletRequest.PRACK, OpenCloud, 1.1
|
A PRACK request was received. |
javax.servlet.sip.SipServletRequest.UPDATE, OpenCloud, 1.1
|
An UPDATE request was received. |
javax.servlet.sip.SipServletRequest.MESSAGE, OpenCloud, 1.1
|
A MESSAGE request was received. |
javax.servlet.sip.SipServletRequest.SUBSCRIBE, OpenCloud, 1.1
|
A SUBSCRIBE request was received. |
javax.servlet.sip.SipServletRequest.NOTIFY, OpenCloud, 1.1
|
A NOTIFY request was received. |
javax.servlet.sip.SipServletRequest.REFER, OpenCloud, 1.1
|
A REFER request was received. |
javax.servlet.sip.SipServletRequest.PUBLISH, OpenCloud, 1.1
|
A PUBLISH request was received. |
javax.servlet.sip.SipServletRequest.UNKNOWN, OpenCloud, 1.1
|
A request with an unrecognized method was received.
Use |
javax.servlet.sip.SipServletResponse.PROVISIONAL, OpenCloud, 1.1
|
A provisional (100-199) response was received. |
javax.servlet.sip.SipServletResponse.SUCCESS, OpenCloud, 1.1
|
A success (200-299) response was received. |
javax.servlet.sip.SipServletResponse.REDIRECT, OpenCloud, 1.1
|
A redirect (300-399) response was received. |
javax.servlet.sip.SipServletResponse.ERROR, OpenCloud, 1.1
|
An error (400-699) response was received. |
javax.servlet.sip.SipErrorEvent.NoAckReceived, OpenCloud, 1.1
|
An OK response to an earlier INVITE was sent, but the ACK was never received (after 32s). |
javax.servlet.sip.SipErrorEvent.NoPrackReceived, OpenCloud, 1.1
|
A reliable provisional response was sent, but the PRACK was never received (after 32s). |
javax.servlet.sip.SipApplicationSessionEvent.Created, OpenCloud, 1.1
|
A new SipApplicationSession was created. |
javax.servlet.sip.SipApplicationSessionEvent.Created, OpenCloud, 1.1
|
A new SipApplicationSession was created. |
javax.servlet.sip.SipApplicationSessionEvent.Expired, OpenCloud, 1.1
|
A SipApplicationSession has expired. |
javax.servlet.sip.SipApplicationSessionEvent.Expired, OpenCloud, 1.1
|
A SipApplicationSession has expired. |
javax.servlet.sip.SipApplicationSessionEvent.ReadyToInvalidate, OpenCloud, 1.1
|
A SipApplicationSession has become ready to invalidate. |
javax.servlet.sip.SipApplicationSessionEvent. ReadyToInvalidate, OpenCloud, 1.1
|
A SipApplicationSession has become ready to invalidate. |
javax.servlet.sip.SipSessionEvent.Created, OpenCloud, 1.1
|
A new SipSession was created. |
javax.servlet.sip.SipSessionEvent.ReadyToInvalidate, OpenCloud, 1.1
|
A SipApplicationSession has expired. |
javax.servlet.sip.SipSessionEvent.Invalidate, OpenCloud, 1.1
|
A SipApplicationSession has become ready to invalidate. |
javax.servlet.sip.SipSessionEvent.Invalidate, OpenCloud, 1.1
|
A SipApplicationSession has become ready to invalidate. |
|
|
Some things to note about SIP Servlet events
|
Interfaces
The SIP Servlet RA type specifies these intefaces: SipFactory (the SBB Interface), SipSessionsUtil and ActivityContextInterface.
SipFactory
The SIP Servlet SipFactory interface is this RA Type’s SBB interface. An instance of SipFactory is bound in the SBB’s JNDI environment when the SBB declares an RA Type binding in their sbb-jar.xml deployment descriptor:
<resource-adaptor-type-binding>
<resource-adaptor-type-ref>
<resource-adaptor-type-name>SIP Servlet RA Type</resource-adaptor-type-name>
<resource-adaptor-type-vendor>OpenCloud</resource-adaptor-type-vendor>
<resource-adaptor-type-version>1.1</resource-adaptor-type-version>
</resource-adaptor-type-ref>
<activity-context-interface-factory-name>slee/resources/sipservlet/activitycontextinterfacefactory</activity-context-interface-factory-name>
<resource-adaptor-entity-binding>
<resource-adaptor-object-name>slee/resources/sipservlet/provider</resource-adaptor-object-name>
<resource-adaptor-entity-link>slee/resources/sipservlet</resource-adaptor-entity-link>
</resource-adaptor-entity-binding>
</resource-adaptor-type-binding>
In the above example, the SipFactory is bound to the name "slee/resources/sipservlet/provider". An SBB object can retrieve the SipFactory as follows:
public abstract class MySipSbb implements Sbb {
private SipFactory sipFactory;
public void setSbbContext(SbbContext context) {
try {
Context env = (Context) new InitialContext().lookup("java:comp/env");
this.sipFactory = (SipFactory) env.lookup("slee/resources/sipservlet/provider");
} catch (NamingException e) {
...
}
}
}
SipSessionsUtil
The SipSessionsUtil interface is made available to SBBs using a separate RA Type. To access SipSessionsUtil, SBBs must declare the following RA Type binding (in addition to the SIP Servlet RA Type as shown above):
<resource-adaptor-type-binding>
<resource-adaptor-type-ref>
<resource-adaptor-type-name>SIP Servlet-sessionsutil RA Type</resource-adaptor-type-name>
<resource-adaptor-type-vendor>OpenCloud</resource-adaptor-type-vendor>
<resource-adaptor-type-version>1.1</resource-adaptor-type-version>
</resource-adaptor-type-ref>
<resource-adaptor-entity-binding>
<resource-adaptor-object-name>slee/resources/sipservlet/sessionsutilprovider</resource-adaptor-object-name>
<resource-adaptor-entity-link>slee/resources/sipservlet</resource-adaptor-entity-link>
</resource-adaptor-entity-binding>
</resource-adaptor-type-binding>
…and obtain the reference from JNDI:
public abstract class MySipSbb implements Sbb {
private SipFactory sipFactory;
private SipSessionsUtil sessionsUtil;
public void setSbbContext(SbbContext context) {
try {
Context env = (Context) new InitialContext().lookup("java:comp/env");
this.sipFactory = (SipFactory) env.lookup("slee/resources/sipservlet/provider");
this.sessionsUtil = (SipFactory) env.lookup("slee/resources/sipservlet/sessionsutilprovider");
} catch (NamingException e) {
...
}
}
}
ActivityContextInterface
The ActivityContextInterface factory interface for the SIP Servlet RA Type is com.opencloud.sipservlet.ratype.SipServletActivityContextInterfaceFactory:
public interface SipServletActivityContextInterfaceFactory {
public ActivityContextInterface getActivityContextInterface(SipSession session)
throws UnrecognizedActivityException, FactoryException;
public ActivityContextInterface getActivityContextInterface(SipApplicationSession session)
throws UnrecognizedActivityException, FactoryException;
}
