Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.session.ColorNegotiationHook Class Reference
Inheritance diagram for de.fu_berlin.inf.dpp.session.ColorNegotiationHook:
de.fu_berlin.inf.dpp.negotiation.hooks.ISessionNegotiationHook

List of all members.

Public Member Functions

 ColorNegotiationHook (Preferences preferences, SessionNegotiationHookManager hooks, ISarosSessionManager sessionManager)
Map< String, String > tellClientPreferences ()
Map< String, String > considerClientPreferences (JID client, Map< String, String > input)
void applyActualParameters (Map< String, String > settings)
String getIdentifier ()

Static Public Attributes

static final String KEY_CLIENT_COLOR = "clientColor"
static final String KEY_CLIENT_FAV_COLOR = "clientFavoriteColor"
static final String KEY_HOST_COLOR = "hostColor"
static final String KEY_HOST_FAV_COLOR = "hostFavoriteColor"

Constructor & Destructor Documentation

de.fu_berlin.inf.dpp.session.ColorNegotiationHook.ColorNegotiationHook ( Preferences  preferences,
SessionNegotiationHookManager  hooks,
ISarosSessionManager  sessionManager 
)

Member Function Documentation

void de.fu_berlin.inf.dpp.session.ColorNegotiationHook.applyActualParameters ( Map< String, String >  settings)

Duty of the client: Apply the parameters defined by the host.

This method will be called on the client's side upon reception of the actual session parameters determined by the host. The hook itself is responsible for accessing and modifying the according components (e.g. the SarosSessionManager). This method will be called right before the Session is created on the client side (via SarosSessionManager.joinSession()) and may not rely on the effects of other hooks.

Parameters:
settingsThe parameters concerning the hook at hand, which were determined by the host during his OutgoingSessionNegotiation (i.e. the return value of considerClientPreferences(JID, Map) ). Might be null, if the host has no counterpart for this hook.

Implements de.fu_berlin.inf.dpp.negotiation.hooks.ISessionNegotiationHook.

Map<String, String> de.fu_berlin.inf.dpp.session.ColorNegotiationHook.considerClientPreferences ( JID  client,
Map< String, String >  input 
)

Consider the client's preferences on the host side.

This method will be called by the host (during the OutgoingSessionNegotiation) to determine the session settings. Therefore, the host might consider the preferences of the client.

Parameters:
clientThe JID of the user the input comes from (just in case the host needs to keep track of who preferred what)
inputThe preferences the client sent during his IncomingSessionNegotiation (i.e. the return value of tellClientPreferences()). Might be null, if the client has no counterpart for this hook.
Returns:
The settings determined by the host which -- if not null -- will be sent back to the client. It's up to the specific hook to which extent the host considers the wishes of the client.

Implements de.fu_berlin.inf.dpp.negotiation.hooks.ISessionNegotiationHook.

String de.fu_berlin.inf.dpp.session.ColorNegotiationHook.getIdentifier ( )

Retrieves the hook's identifier.

The identifier is used to match the two parts of the hook (on client and host side). Therefore, changing the identifier of a hook breaks the compatibility with older Saros versions.

Returns:
A unique string identifying the hook.

Implements de.fu_berlin.inf.dpp.negotiation.hooks.ISessionNegotiationHook.

Map<String, String> de.fu_berlin.inf.dpp.session.ColorNegotiationHook.tellClientPreferences ( )

Receive the client's preferences for later consideration.

During the invitation this method will be called on the client side (see IncomingSessionNegotiation). The client may use this opportunity to tell the host (inviter) his preferences concerning the session parameters.

Returns:
The settings in form of [Key, Value] pairs. If null, the settings won't be transferred to the host.

Implements de.fu_berlin.inf.dpp.negotiation.hooks.ISessionNegotiationHook.


Member Data Documentation

final String de.fu_berlin.inf.dpp.session.ColorNegotiationHook.KEY_CLIENT_FAV_COLOR = "clientFavoriteColor" [static]
final String de.fu_berlin.inf.dpp.session.ColorNegotiationHook.KEY_HOST_FAV_COLOR = "hostFavoriteColor" [static]
 All Classes Namespaces Files Functions Variables Enumerations