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.

Note 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-ready is enabled and all SipSessions are 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 SipSession is ready to invalidate (for example, a dialog-ending request 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
Description
Class

javax.servlet.sip.SipServletRequest.INVITE, OpenCloud, 1.1 SipServlet.doInvite()

An INVITE request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.ACK, OpenCloud, 1.1 SipServlet.doAck()

An ACK request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.CANCEL, OpenCloud, 1.1 SipServlet.doCancel()

A CANCEL request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.BYE, OpenCloud, 1.1 SipServlet.doBye()

A BYE request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.OPTIONS, OpenCloud, 1.1 SipServlet.doOptions()

An OPTIONS request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.REGISTER, OpenCloud, 1.1 SipServlet.doRegister()

A REGISTER request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.INFO, OpenCloud, 1.1 SipServlet.doInfo()

An INFO request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.PRACK, OpenCloud, 1.1 SipServlet.doPrack()

A PRACK request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.UPDATE, OpenCloud, 1.1 SipServlet.doUpdate()

An UPDATE request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.MESSAGE, OpenCloud, 1.1 SipServlet.doMessage()

A MESSAGE request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.SUBSCRIBE, OpenCloud, 1.1 SipServlet.doSubscribe()

A SUBSCRIBE request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.NOTIFY, OpenCloud, 1.1 SipServlet.doNotify()

A NOTIFY request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.REFER, OpenCloud, 1.1 SipServlet.doRefer()

A REFER request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.PUBLISH, OpenCloud, 1.1 SipServlet.doPublish()

A PUBLISH request was received.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletRequest.UNKNOWN, OpenCloud, 1.1 SipServlet.doRequest()

A request with an unrecognized method was received. Use SipServletRequest.getMethod() to obtain the method.
javax.servlet.sip.SipServletRequest

javax.servlet.sip.SipServletResponse.PROVISIONAL, OpenCloud, 1.1 SipServlet.doProvisionalResponse()

A provisional (100-199) response was received.
javax.servlet.sip.SipServletResponse

javax.servlet.sip.SipServletResponse.SUCCESS, OpenCloud, 1.1 SipServlet.doSuccessResponse()

A success (200-299) response was received.
javax.servlet.sip.SipServletResponse

javax.servlet.sip.SipServletResponse.REDIRECT, OpenCloud, 1.1 javax.SipServlet.doRedirectResponse()

A redirect (300-399) response was received.
javax.servlet.sip.SipServletResponse

javax.servlet.sip.SipServletResponse.ERROR, OpenCloud, 1.1 SipServlet.doErrorResponse()

An error (400-699) response was received.
javax.servlet.sip.SipServletResponse

javax.servlet.sip.SipErrorEvent.NoAckReceived, OpenCloud, 1.1 SipErrorListener.noAckReceived()

An OK response to an earlier INVITE was sent, but the ACK was never received (after 32s).
javax.servlet.sip.SipErrorEvent

javax.servlet.sip.SipErrorEvent.NoPrackReceived, OpenCloud, 1.1 SipErrorListener.noPrackReceived()

A reliable provisional response was sent, but the PRACK was never received (after 32s).
javax.servlet.sip.SipErrorEvent

javax.servlet.sip.SipApplicationSessionEvent.Created, OpenCloud, 1.1 SipApplicationSessionListener.sessionCreated()

A new SipApplicationSession was created.
javax.servlet.sip.SipApplicationSessionEvent

javax.servlet.sip.SipApplicationSessionEvent.Created, OpenCloud, 1.1 SipApplicationSessionListener.sessionCreated()

A new SipApplicationSession was created.
javax.servlet.sip. SipApplicationSessionEvent

javax.servlet.sip.SipApplicationSessionEvent.Expired, OpenCloud, 1.1 SipApplicationSessionListener.sessionExpired()

A SipApplicationSession has expired.
javax.servlet.sip.SipApplicationSessionEvent

javax.servlet.sip.SipApplicationSessionEvent.Expired, OpenCloud, 1.1 SipApplicationSessionListener.sessionExpired()

A SipApplicationSession has expired.
javax.servlet.sip. SipApplicationSessionEvent

javax.servlet.sip.SipApplicationSessionEvent.ReadyToInvalidate, OpenCloud, 1.1 SipApplicationSessionListener.sessionReadyToInvalidate()

A SipApplicationSession has become ready to invalidate.
javax.servlet.sip.SipApplicationSessionEvent

javax.servlet.sip.SipApplicationSessionEvent. ReadyToInvalidate, OpenCloud, 1.1 SipApplicationSessionListener. sessionReadyToInvalidate()

A SipApplicationSession has become ready to invalidate.
javax.servlet.sip. SipApplicationSessionEvent

javax.servlet.sip.SipSessionEvent.Created, OpenCloud, 1.1 SipSessionListener.sessionCreated()

A new SipSession was created.
javax.servlet.sip.SipSessionEvent

javax.servlet.sip.SipSessionEvent.ReadyToInvalidate, OpenCloud, 1.1 SipSessionListener.sessionCreated()

A SipApplicationSession has expired.
javax.servlet.sip.SipSessionEvent

javax.servlet.sip.SipSessionEvent.Invalidate, OpenCloud, 1.1 SipApplicationSessionListener.SessionReadyToInvalidate()

A SipApplicationSession has become ready to invalidate.
javax.servlet.sip.SipSessionEvent

javax.servlet.sip.SipSessionEvent.Invalidate, OpenCloud, 1.1 SipApplicationSessionListener. SessionReadyToInvalidate()

A SipApplicationSession has become ready to invalidate.
javax.servlet.sip.SipSessionEvent

Warning
Some things to note about SIP Servlet events
  • Initial requests and mid-dialog requests have the same event type. The application must distingush between them using SipServletRequest.isInitial(), just as SIP servlets do.

  • All events above are fired on the SipApplicationSession activity. Events that relate to a particular SipSession are still fired on the SipApplicationSession, but the SipSession can always be retrieved from the event object. The decision to fire all events on the SipApplicationSession was made only to avoid scenarios where the same event type could have been fired on either type of activity, depending on what made sense in particular circumstances. Just firing on the SipApplicationSession makes it simpler for the developer to reason about the events.

  • There are no ServletTimer events, as the same functionality is already provided by the SLEE TimerFacility.

  • There are no "session destroyed" events. The SLEE ActivityEndedEvent can be used for the same purpose.

  • SipServletListener.servletInitialized() and the session attribute listeners are not part of this RA type. However they are implemented by the container service when running SIP Servlet applications.

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;
}
Previous page Next page