org.glassfish.cafe.api
Interface CommunicationSession


public interface CommunicationSession

Instance of a CommunicationSession object. Application can create Communication objects from a CommunicationSession. When an event (eg: CommunicationEvent or ParticipantEvent) gets executed later for a Communication created from this CommunicationSession, the same CommunicationSession object will be injected into the CommunicationBean.

Author:
binod
See Also:
Message, Communication

Field Summary
static String NAME
          Name of the HTTP session attribute to retrieve an instance of CommunicationSession.
 
Method Summary
<C extends Communication>
C
createCommunication(Class<C> type, String name, Communication other, Object... arg)
          A generic method to create any type of communication from another communication.
<C extends Communication>
C
createCommunication(Class<C> type, String name, Participant initiator, Object... arg)
          A generic method to create any type of communication.
 Conference createConference()
          Create a conference with a specified name.
 Conference createConference(String name)
          Create a conference with a specified name.
 Conference createConference(String name, Conversation c)
          Create a conference from the Conversation.
 Conversation createConversation(Participant initiator)
          Create a Conversation between the initiator and another party.
 Conversation createConversation(Participant initiator, String name)
          Create a Conversation between the initiator and another party.
 Conversation createConversation(String initiator)
          Create a Conversation between the initiator and another party.
 Conversation createConversation(String initiator, String name)
          Create a Conversation between the initiator and another party.
 IMConference createIMConference()
          Create an IMConference.
 IMConference createIMConference(String name)
          Create an IMConference with a specified name.
 IMConference createIMConference(String name, IMConversation c)
          Create an IMConference from the IMConversation.
 IMConversation createIMConversation(String initiator)
          Create an IMConversation between the initiator and another party.
 IMConversation createIMConversation(String initiator, String name)
          Create an IMConversation between the initiator and another party.
 MSRPConference createMSRPConference(String name)
          Create a MSRPConference with a specified name.
 MSRPConference createMSRPConference(String name, MSRPConversation c)
          Create a MSRPConference from a MSRPConversation.
<P extends Participant>
P
createParticipant(Class<P> type, String name)
          Create a participant, that can be added to the Communication.
<P extends Participant>
P
createParticipant(Class<P> type, String name, javax.media.mscontrol.join.Joinable j)
          Create a participant that can be added to the communication with a specific Joinable.
 PresenceSource createPresenceSource(String userId)
          Creates a Presence Source using the provided user ID as its IMS entity.
 PresenceWatcher createPresenceWatcher(Group group)
          Creates a presence watcher.
 PresenceWatcher createPresenceWatcher(String fromUserId, String toUserId)
          Creates a presence watcher.
 Registration createRegistration(String fromUserId)
          Creates a Registration with fromUserId as the user identity to register on the network.
 Registration createRegistration(String fromUserId, List<ProxyAuthentication> authList)
          Creates a Registration with fromUserId as the user identity to register on the network, with a list of credentials.
 Registration createRegistration(String fromUserId, ProxyAuthentication auth)
          Creates a Registration with fromUserId as the user identity to register on the network, with one set of credentials.
 WatcherInfoSubscriber createWatcherInfoSubscriber(String userId)
          Creates a WatcherInfoSubscriber object for the given user ID.
 Map<?,?> getAllAttributes()
          Retrieve all attributes set in this session.
 Object getAttribute(String name)
          Retrieve the attribute from the session.
 Object removeAttribute(String name)
          Remove the attribute from the session.
 void setAttribute(String name, Object value)
          Set an attribute in the session.
 

Field Detail

NAME

static final String NAME
Name of the HTTP session attribute to retrieve an instance of CommunicationSession.

See Also:
Constant Field Values
Method Detail

setAttribute

void setAttribute(String name,
                  Object value)
Set an attribute in the session. The attribute value should be a Serializable Object.

Parameters:
name - Name of the attribute.
value - Value of the attribute.

getAttribute

Object getAttribute(String name)
Retrieve the attribute from the session.

Parameters:
name - of the attribute.
Returns:
Value of the attribute set earlier.

getAllAttributes

Map<?,?> getAllAttributes()
Retrieve all attributes set in this session.

Returns:
a Map of all attributes set so far.

removeAttribute

Object removeAttribute(String name)
Remove the attribute from the session.

Parameters:
name - Name of the attribute
Returns:
The value of the attribute removed. Returns null, if the attribute doesn't exist.

createConference

Conference createConference()
Create a conference with a specified name. This method is equivalent to executing createConference(null)

Returns:
An instance of Conference.
See Also:
Conference

createConference

Conference createConference(String name)
Create a conference with a specified name. If the name is null, CAFE container would create a name for the conference. This is usually in the form of ".". For example, if application executes this method three times with a null name, CAFE container might assign "Conference.12", "Conference.13" and "Conference.14" as the names of the conferences. CAFE container would make sure that names created are unique within the conferences created by the container.

Parameters:
name - Name of the conference.
Returns:
An instance of Conference.
See Also:
Conference

createConference

Conference createConference(String name,
                            Conversation c)
Create a conference from the Conversation. If the recipient of the conversation and the name are the same, then a the sender will be added to the conference. If the recipient of the Conversation is different from the name, then a new conference will be created with the specified name and both the parties mentioned will be added to the conference.

Parameters:
name - Name of the conference.
c - Conversation object
Returns:
An instance of Conference.
See Also:
Conference

createConversation

Conversation createConversation(String initiator,
                                String name)
Create a Conversation between the initiator and another party. Name will be used as the name of this communication. If the name is null, CAFE container would create a name for the communication. This is usually in the form of ".". For example, if application executes this method three times with a null name, CAFE container might assign "Conversation.12", "Conversation.13" and "Conversation.14" as the names of the calls. CAFE container would make sure that names created are unique within the calls created by container.

Parameters:
name - Name of the Conversation.
initiator - Initiator of the Conversation.
Returns:
An instance of Conversation.
See Also:
Conversation

createConversation

Conversation createConversation(String initiator)
Create a Conversation between the initiator and another party. This method is equivalent to executing createCall(initiator, null).

Parameters:
initiator - Initiator of the Conversation.
Returns:
An instance of Conversation.
See Also:
Conversation

createConversation

Conversation createConversation(Participant initiator,
                                String name)
Create a Conversation between the initiator and another party. Name will be used as the name of this communication. If the name is null, CAFE container would create a name for the communication. This is usually in the form of ".". For example, if application executes this method three times with a null name, CAFE container might assign "Conversation.12", "Conversation.13" and "Conversation.14" as the names of the calls. CAFE container would make sure that names created are unique within the calls created by container.

Parameters:
name - Name of the Conversation.
initiator - Initiator of the Conversation.
Returns:
An instance of Conversation.
See Also:
Conversation

createConversation

Conversation createConversation(Participant initiator)
Create a Conversation between the initiator and another party. This method is equivalent to executing createCall(initiator, null).

Parameters:
initiator - Initiator of the Conversation.
Returns:
An instance of Conversation.
See Also:
Conversation

createIMConversation

IMConversation createIMConversation(String initiator,
                                    String name)
Create an IMConversation between the initiator and another party. Name will be used as the name of this communication. If the name is null, CAFE container would create a name for the communication. This is usually in the form of ".". For example, if application executes this method three times with a null name, CAFE container might assign "IMConversation.12", "IMConversation.13" and "IMConversation.14" as the names of the calls. CAFE container would make sure that names created are unique within the calls created by container.

Parameters:
name - Name of the IMConversation.
initiator - Initiator of the IMConversation.
Returns:
An instance of IMConversation.
See Also:
IMConversation

createIMConversation

IMConversation createIMConversation(String initiator)
Create an IMConversation between the initiator and another party. This method is equivalent to executing createCall(initiator, null).

Parameters:
initiator - Initiator of the IMConversation.
Returns:
An instance of IMConversation.
See Also:
IMConversation

createIMConference

IMConference createIMConference()
Create an IMConference. This method is equivalent to executing createIMConference(null)

Returns:
An instance of IMConference.
See Also:
IMConference

createIMConference

IMConference createIMConference(String name)
Create an IMConference with a specified name. If the name is null, CAFE container would create a name for the IMConference. This is usually in the form of ".". For example, if application executes this method three times with a null name, CAFE container might assign "IMConference.12", "IMConference.13" and "IMConference.14" as the names of the IMConferences. CAFE container would make sure that names created are unique within the IMConferences created by the container.

Parameters:
name - Name of the IMConference.
Returns:
An instance of IMConference.
See Also:
IMConference

createIMConference

IMConference createIMConference(String name,
                                IMConversation c)
Create an IMConference from the IMConversation. If the recipient of the IMConversation and the name are the same, then a the sender will be added to the IMConference. If the recipient of the IMConversation is different from the name, then a new IMConference will be created with the specified name and both the parties mentioned will be added to the IMConference.

Parameters:
name - Name of the IMConference.
c - IMConversation object
Returns:
An instance of IMConference.
See Also:
IMConference

createCommunication

<C extends Communication> C createCommunication(Class<C> type,
                                                String name,
                                                Participant initiator,
                                                Object... arg)
A generic method to create any type of communication. For example, for creating an IMConversation, this method might be invoked as follows. CommunicationSession session = .... UserParticipant initiator = session.createParticipant(UserParticipant.class, "alice@example.com"); IMConversation imc = session.createCommunication(IMConversation.class, "alice-chat", initiator); This also enables extending CAFE with new types of Communications.

Type Parameters:
C - Generic type name of the communication
Parameters:
type - Class of the Communication to be created.
name - Name of the Communication.
initiator - Initiator of the Communication.
arg - Any additional argument, a third party might require.
Returns:
Instance of the Communication object.

createCommunication

<C extends Communication> C createCommunication(Class<C> type,
                                                String name,
                                                Communication other,
                                                Object... arg)
A generic method to create any type of communication from another communication. For example, for creating an Conference from a Conversation, this method might be invoked as follows. CommunicationSession session = .... Conversation conv = ...// Conference conf = session.createCommunication(Conference.class, "conference@example.com", conv); This also enables extending CAFE with new types of Communications.

Type Parameters:
C - Generic type name of the communication
Parameters:
type - Class of the Communication to be created.
name - Name of the Communication.
other - The input communication.
arg - Any additional argument, a third party might require.
Returns:
Instance of the Communication object.

createMSRPConference

MSRPConference createMSRPConference(String name,
                                    MSRPConversation c)
Create a MSRPConference from a MSRPConversation. If the MSRPConference with the same name already exists, then the CommunicationException will be thrown.

Parameters:
name - Unique name to identify the MSRPConference
c - MSRPConversation object
Returns:
A new instance of the MSRPConference object.
Throws:
CommunicationException - If the MSRPConference with the same name already exists.

createMSRPConference

MSRPConference createMSRPConference(String name)
Create a MSRPConference with a specified name. The name must be unique.

Parameters:
name - Unique name to identify the MSRPConference.
Returns:
A new instance of the MSRPConference object.
Throws:
CommunicationException - If the MSRPConference with the same name already exists.

createParticipant

<P extends Participant> P createParticipant(Class<P> type,
                                            String name)
Create a participant, that can be added to the Communication.

Type Parameters:
P - Any Participant type that extends a MediaParticipant.
Parameters:
type - Any Class that extends MediaParticipant class.
name - Name of the participant
Returns:
An instance of the MediaParticipant object.

createParticipant

<P extends Participant> P createParticipant(Class<P> type,
                                            String name,
                                            javax.media.mscontrol.join.Joinable j)
Create a participant that can be added to the communication with a specific Joinable. The Joinable passed in can be retrieved using getJoinable method. If it is null, then a new JSR 309 Joinable will be created by CAFE.

Type Parameters:
P - Any Participant type that extends a MediaParticipant.
Parameters:
type - Any Class that extends MediaParticipant class.
name - Name of the participant
j - An instance of Joinable object.
Returns:
An instance of the MediaParticipant object.

createRegistration

Registration createRegistration(String fromUserId)
Creates a Registration with fromUserId as the user identity to register on the network.

Parameters:
fromUserId - The user identity to register.
Returns:
the Registration object that can perform the registration.

createRegistration

Registration createRegistration(String fromUserId,
                                ProxyAuthentication auth)
Creates a Registration with fromUserId as the user identity to register on the network, with one set of credentials.

Parameters:
fromUserId - The user identity to register.
auth - A set of credentials.
Returns:
the Registration object that can perform the registration.

createRegistration

Registration createRegistration(String fromUserId,
                                List<ProxyAuthentication> authList)
Creates a Registration with fromUserId as the user identity to register on the network, with a list of credentials.

Parameters:
fromUserId - The user identity to register.
authList - A list with credentials.
Returns:
the Registration object that can perform the registration.

createPresenceSource

PresenceSource createPresenceSource(String userId)
Creates a Presence Source using the provided user ID as its IMS entity. A default associated PresenceDocument with status 'Online' is created, too.

Parameters:
userId - the entity to use for publishing.
Returns:
the PresenceSource object to publish presence information.

createPresenceWatcher

PresenceWatcher createPresenceWatcher(Group group)
Creates a presence watcher.

Parameters:
group - The (user specific) group of users to be watched.
Returns:
the PresenceWatcher for the specified group.

createPresenceWatcher

PresenceWatcher createPresenceWatcher(String fromUserId,
                                      String toUserId)
Creates a presence watcher.

Parameters:
fromUserId - the watcher
toUserId - the presentity watched
Returns:
the PresenceWatcher for the specified toUser.

createWatcherInfoSubscriber

WatcherInfoSubscriber createWatcherInfoSubscriber(String userId)
Creates a WatcherInfoSubscriber object for the given user ID.

Parameters:
userId - the entity that is subscribing, which is also the user ID of which the Watcher state changes are going to be reported.
Returns:
the WatcherInfoSubscriber object created.


Copyright © 2010. All Rights Reserved.