org.glassfish.cafe.api
Interface CommunicationService


public interface CommunicationService

An utility class to create objects that are not related to a CommunicationSession, for example groups.


Field Summary
static String NAME
          Name of the HTTP session attribute to retrieve an instance of CommunicationService.
 
Method Summary
 Group createGroup(String groupName, String uid)
          Creates an empty group for a user.
 Group createGroup(String groupName, String uid, Map<String,String> buddyList)
          Creates a group for a user with a number of buddies.
 ProxyAuthentication createProxyAuthentication(String domain, String userid, String password)
          Creates a proxy authentication for a registration.
 void createRuleSetFromTemplate(String uid, RuleSetType type)
          Create a rules set and shared list according to the specified template.
 void deleteRuleSetFromTemplate(String uid)
          Deletes all the rules from the rule set.
<C extends Communication>
Collection<C>
findByInitiator(Class<C> type, String initiator)
          Search for all communication initiated by a particular user.
<C extends Communication>
C
findByName(Class<C> type, String name)
          Search API for communication by name.
<C extends Communication>
Collection<C>
findByParticipant(Class<C> type, String participantName)
          Search for all communication where a particular user is present.
<C extends Communication>
Collection<C>
findCommunications(Class<C> type)
          Method that returns all the communications for that application depending on the type of communication,
 Group getGroup(String uid, String groupName)
          Returns the group for the specified user and group name.
 List<Group> getGroups(String uid)
          returns the list of groups for the specified user.
 RuleSetType getRuleSetType(String uid)
          Attempts to determine the ruleset type.
 

Field Detail

NAME

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

See Also:
Constant Field Values
Method Detail

createRuleSetFromTemplate

void createRuleSetFromTemplate(String uid,
                               RuleSetType type)
Create a rules set and shared list according to the specified template. If a rule set is not explicitly created then it is be implicitly created when the first group is created. If the first group is named "rcs" the RCS type will be used. Any other name will default to the OMA_WHITELIST template.

Parameters:
type - the type of ruleset and corresponding shared lists that are created.

deleteRuleSetFromTemplate

void deleteRuleSetFromTemplate(String uid)
Deletes all the rules from the rule set.


getRuleSetType

RuleSetType getRuleSetType(String uid)
Attempts to determine the ruleset type. This is based on some of the rules and shared list present. If the user modified the ruleset or the shared lists XDM via other means than this API, the results might either not be accurate or null can be returned if no rules can be found that match the known rule set types.
I.e. it is only a best attempt and is only guaranteed to work if the set is created via this API.

Returns:
null if there are no rules or if the ruleset type can not be determined.
otherwise the ruleset type is returned.

createGroup

Group createGroup(String groupName,
                  String uid,
                  Map<String,String> buddyList)
Creates a group for a user with a number of buddies.

Parameters:
groupName - the name of the group, unique for this user
uid - the URI of the owner of the group.
buddlist - List of the buddies to be inserted. Each of the entries in the buddy list have the buddy's user ID as key and the buddy's display name as value.
Returns:
the newly created Group
Throws:
IllegalStateException - if the RCS ruleset template is used and a list other then "rcs" would be created

createGroup

Group createGroup(String groupName,
                  String uid)
Creates an empty group for a user.

Parameters:
groupName - the name of the group, unique for this user
uid - the URI of the owner of the group.
Returns:
the newly created Group
Throws:
IllegalStateException - if the RCS ruleset template is used and a list other then "rcs" would be created

getGroup

Group getGroup(String uid,
               String groupName)
Returns the group for the specified user and group name.

Parameters:
uid - the URI of the owner of the group.
groupName - the name of the wanted group
Returns:
the found Group

getGroups

List<Group> getGroups(String uid)
returns the list of groups for the specified user.

Parameters:
uid - the URI of the owner of the group.
Returns:
the found Groups

createProxyAuthentication

ProxyAuthentication createProxyAuthentication(String domain,
                                              String userid,
                                              String password)
Creates a proxy authentication for a registration.

Parameters:
domain - the name of the realm for which credentials are needed.
userid - the userid.
password - the password necessary for this realm.
Returns:
the newly created ProxyAuthentication

findCommunications

<C extends Communication> Collection<C> findCommunications(Class<C> type)
Method that returns all the communications for that application depending on the type of communication,

Type Parameters:
C - Communication. Can be conversation, conference..
Parameters:
type - Type of the Communication class.
Returns:
list of communications.

findByName

<C extends Communication> C findByName(Class<C> type,
                                       String name)
Search API for communication by name.

Type Parameters:
C - communication
Parameters:
type - type of communication
name - name of the communication
Returns:
communication if found.

findByInitiator

<C extends Communication> Collection<C> findByInitiator(Class<C> type,
                                                        String initiator)
Search for all communication initiated by a particular user.

Type Parameters:
C - type of communication
Parameters:
type - communication class
initiator - Caller of the communication.
Returns:
collection of communicationm that matches the criteria.

findByParticipant

<C extends Communication> Collection<C> findByParticipant(Class<C> type,
                                                          String participantName)
Search for all communication where a particular user is present.

Type Parameters:
C - Communication
Parameters:
type - type of communication
participantName - name of the participant
Returns:
all communications that contain this participant.


Copyright © 2010. All Rights Reserved.