JBoss.orgCommunity Documentation

Chapter 2. Resource Adaptor Type

2.1. Activities
2.2. Events
2.3. Activity Context Interface Factory
2.4. Resource Adaptor Interface
2.5. Restrictions
2.6. Sbb Code Examples
2.6.1. Connection Creation
2.6.2. Message Sending

The Resource Adaptor Type is the interface which defines the contract between the RA implementations, the SLEE container, and the Applications running in it.

The name of the RA Type is XMPPResourceAdaptorType, its vendor is org.mobicents and its version is 2.0.

The single activity object for XMPP Resource Adaptor is the org.mobicents.slee.resource.xmpp.XmppConnection interface. The activity represents a connection to an XMPP Server, of client or component type, where a sequence of incoming XMPP messages - the events- occur.

The XmppConnection activity starts when an SBB requests a new connection to be created, through the RA SBB Interface, and it ends when an SBB uses the same interface to request the closing of the connection.

The activity also gives access to the underlying connection on the SMACK API, through the method named getConnection(). With that object the SBB is able to completely interact with the resource. For further information about the SMACK API refer to its website at http://www.igniterealtime.org/projects/smack/.

The Events fired by XMPP Resource Adaptor represent an incoming message, received in a specific XmppConnection activity. The table below lists the Resource Adaptor Type event types.


Important

Spaces where introduced in Name, Vendor and Event Class column values, to correctly render the table. Please remove them when using copy/paste.

Important

More details for each event type may be obtained on the javadocs of each event type class.

The Resource Adaptor's Activity Context Interface Factory is of type org.mobicents.slee.resource.xmpp.XmppActivityContextInterfaceFactory, it allows the SBB to retrieve the ActivityContextInterface related with a specific XmppConnection activity object. The interface is defined as follows:



        
package org.mobicents.slee.resource.xmpp;
import javax.slee.ActivityContextInterface;
import javax.slee.FactoryException;
import javax.slee.UnrecognizedActivityException;
public interface XmppActivityContextInterfaceFactory {
    public ActivityContextInterface getActivityContextInterface(
            XmppConnection connection) throws NullPointerException,
            UnrecognizedActivityException, FactoryException;
    
}
     

The XMPP Resource Adaptor interface, of type org.mobicents.slee.resource.xmpp.XmppResourceAdaptorSbbInterface , which an SBB uses to interact with XMPP resources, is defined as follows:



        
package org.mobicents.slee.resource.xmpp;
import java.util.Collection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Packet;
public interface XmppResourceAdaptorSbbInterface {
    public XmppConnection getXmppConnection(String connectionId);
    public void sendPacket(String connectionID, Packet packet);
    public XmppConnection connectClient(String connectionID, String serverHost,
            int serverPort, String serviceName, String username,
            String password, String resource, Collection packetFilters)
            throws XMPPException;
    public XmppConnection connectComponent(String connectionID,
            String serverHost, int serverPort, String serviceName,
            String componentName, String componentSecret,
            Collection packetFilters) throws XMPPException;
    
    public void disconnect(String connectionID);        
}
    

The XMPP does not imposes any kind of restriction on the usage of the SMACK API java objects.

The following code examples shows how to use the Resource Adaptor Type for common functionalities