org.glassfish.cafe.api
Interface CommunicationContext<C extends Communication,P extends Participant,M extends Message>

Type Parameters:
C - Communication object in this CommunicationContext.
P - Participant object in this CommunicationContext.
M - Message object in this CommunicationContext.
All Superinterfaces:
Cloneable

public interface CommunicationContext<C extends Communication,P extends Participant,M extends Message>
extends Cloneable

Represents the context related to a particular Communication Event. The application can get the current active Communication and the corresponding message from this object.

Author:
Mohit Gupta, Binod PG

Method Summary
 Object clone()
          Return a copy of the communication context that is thread safe.
 C getCommunication()
          Return the communication associated with the context.
<M extends javax.media.mscontrol.MediaEvent>
M
getMediaEvent(Class<M> eventClass)
          Return the JSR 309 MediaEvent associated with the current context.
 M getMessage()
          Get the current Message from the ongoing conversation.
 P getParticipant()
          Return the current participant.
 Principal getUserPrincipal()
          Returns a java.security.Principal object containing the name of the current authenticated user.
 UserProcedure getUserProcedure()
          Return the current user procedure, if applicable.
 boolean isUserInRole(String role)
          Returns a boolean indicating whether the authenticated user is included in the specified logical "role".
 

Method Detail

getCommunication

C getCommunication()
Return the communication associated with the context.

Returns:
communication

getParticipant

P getParticipant()
Return the current participant.

Returns:
participant

getMessage

M getMessage()
Get the current Message from the ongoing conversation. It will be null if there is no such conversation ongoing.

Returns:
Message
See Also:
Message

getUserProcedure

UserProcedure getUserProcedure()
Return the current user procedure, if applicable.

Returns:
the user procedure

clone

Object clone()
Return a copy of the communication context that is thread safe. Note that the the getClass() of the communication context may not equal the getClass of its clone. So, application is advised to not depend on that behavior.

Returns:
a copy of the CommunicationContext.

getMediaEvent

<M extends javax.media.mscontrol.MediaEvent> M getMediaEvent(Class<M> eventClass)
Return the JSR 309 MediaEvent associated with the current context.

Type Parameters:
M -
Parameters:
eventClass -
Returns:

getUserPrincipal

Principal getUserPrincipal()
Returns a java.security.Principal object containing the name of the current authenticated user.

Returns:
a java.security.Principal containing the name of the user making this request; null if the user has not been authenticated

isUserInRole

boolean isUserInRole(String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.

Parameters:
role - a String specifying the name of the role
Returns:
a boolean indicating whether the user making this request belongs to a given role; false if the user has not been authenticated


Copyright © 2010. All Rights Reserved.