org.universAAL.middleware.ui.impl
Class UIBusImpl

Package class diagram package UIBusImpl
java.lang.Object
  extended by org.universAAL.middleware.bus.model.AbstractBus
      extended by org.universAAL.middleware.ui.impl.UIBusImpl
All Implemented Interfaces:
Broker, MessageListener, IUIBus

public class UIBusImpl
extends AbstractBus
implements IUIBus

Implementation of IUIBus interface

Author:
mtazari, Carsten Stockloew, eandgrg

Field Summary
 
Fields inherited from class org.universAAL.middleware.bus.model.AbstractBus
aalSpaceManager, busStrategy, communicationModule, context, registry
 
Method Summary
 void abortDialog(String callerID, String dialogID)
          Aborts the dialog upon request from the application or Dialog Manager.
 void adaptationParametersChanged(IDialogManager dm, UIRequest uiRequest, String changedProp)
          Only the Dialog Manager (DM) can call this method.
 void addNewProfile(String handlerID, UIHandlerProfile newProfile)
          Extends the profile of a registered subscriber (UIHandler) with regard to UIRequests that it can handle.
 void assessContentSerialization(Resource content)
           
 void brokerUIRequest(String callerID, UIRequest req)
          Asks the bus to find an appropriate UI handler and forward the request to it for handling
protected  BusStrategy createBusStrategy(CommunicationModule commModule)
           
 void dialogFinished(String handlerID, UIResponse response)
          Whenever a dialog is finished, UIHandlers must inform the IUIBus by calling this method.
 void dialogSuspended(IDialogManager dm, String dialogID)
          Only the Dialog Manager (DM) can call this method.
 UIHandlerProfile[] getMatchingProfiles(String modalityRegex)
          Returns list of UIHandlerProfiles that match the given expression
static ModuleContext getModuleContext()
           
static Object[] getUIBusFetchParams()
           
 void handleSendError(ChannelMessage message, CommunicationConnectorException e)
          Callback for error handling
 void removeMatchingProfile(String handlerID, UIHandlerProfile oldProfile)
          Removes matching patterns of UIRequests from the profile of the UIHandler.
 void resumeDialog(String callerID, String dialogID, Resource dialogData)
          Applications can use this method to ask the IUIBus to resume a dialog that was interrupted due to the activation of a sub-dialog of it.
 void setDialogManager(IDialogManager dm)
           
static void startModule(Container c, ModuleContext mc, Object[] uiBusShareParams, Object[] uiBusFetchParams)
           
static void stopModule()
           
 void unregister(String memberID, BusMember m)
          Unregisters bus member from the bus (if the bus member with given ID exists).
 void unregister(String callerID, UICaller caller)
          Unregisters an application's caller from the bus.
 void unregister(String handlerID, UIHandler handler)
          Unregisters the given UIHandler from the bus..
 void userLoggedIn(String handlerID, Resource user, AbsLocation loginLocation)
          Notifies IUIBus that the human user has logged in (using UIHandler).
 
Methods inherited from class org.universAAL.middleware.bus.model.AbstractBus
addRegistryListener, brokerMessage, createRegistry, dispose, getBrokerName, getBusMember, getBusMemberID, getBusMembers, getBusMembersByID, getCurrentNumberOfPeers, getPeerCard, getPeerFromBusResourceURI, getURI, init, initBrokerage, isBusResourceURI, isValidMember, messageReceived, register, removeRegistryListener, unmarshall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getUIBusFetchParams

public static Object[] getUIBusFetchParams()

assessContentSerialization

public void assessContentSerialization(Resource content)

startModule

public static void startModule(Container c,
                               ModuleContext mc,
                               Object[] uiBusShareParams,
                               Object[] uiBusFetchParams)

stopModule

public static void stopModule()

getModuleContext

public static ModuleContext getModuleContext()
Returns:
ModuleContext

createBusStrategy

protected BusStrategy createBusStrategy(CommunicationModule commModule)
Specified by:
createBusStrategy in class AbstractBus

setDialogManager

public void setDialogManager(IDialogManager dm)
Parameters:
dm - IDialogManager

abortDialog

public void abortDialog(String callerID,
                        String dialogID)
Description copied from interface: IUIBus
Aborts the dialog upon request from the application or Dialog Manager. No matter which one has requested the abort, the bus informs both when the operation is finished (informing the caller as a sort of acknowledgment and informing the other one to prevent unnecessary waiting).

Specified by:
abortDialog in interface IUIBus
Parameters:
callerID - ID of the application that had originally started the dialog
dialogID - ID of the dialog

adaptationParametersChanged

public void adaptationParametersChanged(IDialogManager dm,
                                        UIRequest uiRequest,
                                        String changedProp)
Description copied from interface: IUIBus
Only the Dialog Manager (DM) can call this method. When the DM notices that personal and / or situational parameters relevant for a running dialog have changed, it notifies the IUIBus by calling this method. The IUIBus may then either notify the UIHandler in charge of that dialog to consider the changes (if the changes in the adaptation parameters still match its profile -- see also UIHandler.adaptationParametersChanged(String, String, Object)) or switch to another UIHandler (if the new situation cannot be handled by the previous UIHandler). In the latter case, the previous UIHandler is notified to abort the dialog while returning any intermediate user input collected so far (by calling UIHandler.cutDialog(String)), and then the new UIHandler is mandated (by calling UIHandler.handleUICall(UIRequest)) to continue with the dialog presentation without loss of data.

Specified by:
adaptationParametersChanged in interface IUIBus
Parameters:
dm - Dialog Manager
uiRequest - The whole call context that is affected by the change, including the dialog ID and the the new value of the changed property
changedProp - the property (from among all properties of the call context) that has changed

addNewProfile

public void addNewProfile(String handlerID,
                          UIHandlerProfile newProfile)
Description copied from interface: IUIBus
Extends the profile of a registered subscriber (UIHandler) with regard to UIRequests that it can handle. Responsible (together with IUIBus.removeMatchingProfile(String, UIHandlerProfile)) for changing the handler's profile dynamically.

Specified by:
addNewProfile in interface IUIBus
Parameters:
handlerID - ID of the UIHandler introducing the new registration parameters
newProfile - the new class of UIRequests that can additionally be handled by the given UIHandler

dialogFinished

public void dialogFinished(String handlerID,
                           UIResponse response)
Description copied from interface: IUIBus
Whenever a dialog is finished, UIHandlers must inform the IUIBus by calling this method.

Specified by:
dialogFinished in interface IUIBus
Parameters:
handlerID - ID of the UIHandler that has finished the dialog

dialogSuspended

public void dialogSuspended(IDialogManager dm,
                            String dialogID)
Description copied from interface: IUIBus
Only the Dialog Manager (DM) can call this method. When the DM wants that a running dialog is substituted by another dialog (e.g., because a new UIRequest with a higher priority than the running one is addressing the same user, or because the user wants to switch to another dialog using the "standard buttons"), then it must notify the IUIBus by calling this method. The IUIBus will then ask the UIHandler in charge of handling the running dialog to cut that dialog (see UIHandler.cutDialog(String)) and return all user input collected so far so that the dialog can be resumed later without loss of data.

Specified by:
dialogSuspended in interface IUIBus
Parameters:
dm - Dialog Manager
dialogID - ID of the dialog to suspend

removeMatchingProfile

public void removeMatchingProfile(String handlerID,
                                  UIHandlerProfile oldProfile)
Description copied from interface: IUIBus
Removes matching patterns of UIRequests from the profile of the UIHandler. Responsible (together with IUIBus.addNewProfile(String, UIHandlerProfile)) for changing the handler's profile dynamically.

Specified by:
removeMatchingProfile in interface IUIBus
Parameters:
handlerID - ID of the calling UIHandler that had previously registered 'oldProfile'

resumeDialog

public void resumeDialog(String callerID,
                         String dialogID,
                         Resource dialogData)
Description copied from interface: IUIBus
Applications can use this method to ask the IUIBus to resume a dialog that was interrupted due to the activation of a sub-dialog of it. This is the only case where the applications are aware about a dialog having been suspended because the resumption depends on them having processed the user input in the context of the sub-dialog and having incorporated it into the form data of the parent dialog if needed. Then, they can activate the parent dialog using this method.

Specified by:
resumeDialog in interface IUIBus
Parameters:
callerID - ID of the application that had originally started the dialog
dialogID - ID of the dialog
dialogData - dialog data (see Form.getData())

brokerUIRequest

public void brokerUIRequest(String callerID,
                            UIRequest req)
Asks the bus to find an appropriate UI handler and forward the request to it for handling

Specified by:
brokerUIRequest in interface IUIBus
Parameters:
callerID - the ID of the UICaller that is asking the bus
req - the request to be forwarded to a UI handler
See Also:
IUIBus.brokerUIRequest(java.lang.String, org.universAAL.middleware.ui.UIRequest)

unregister

public void unregister(String callerID,
                       UICaller caller)
Description copied from interface: IUIBus
Unregisters an application's caller from the bus.

Specified by:
unregister in interface IUIBus
Parameters:
callerID - ID of the caller to be unregistered
caller - the caller to be unregistered

unregister

public void unregister(String handlerID,
                       UIHandler handler)
Description copied from interface: IUIBus
Unregisters the given UIHandler from the bus..

Specified by:
unregister in interface IUIBus
Parameters:
handlerID - ID of the handler to be unregistered
handler - the handler to be unregistered

unregister

public void unregister(String memberID,
                       BusMember m)
Description copied from class: AbstractBus
Unregisters bus member from the bus (if the bus member with given ID exists).

Overrides:
unregister in class AbstractBus

userLoggedIn

public void userLoggedIn(String handlerID,
                         Resource user,
                         AbsLocation loginLocation)
Description copied from interface: IUIBus
Notifies IUIBus that the human user has logged in (using UIHandler).

Specified by:
userLoggedIn in interface IUIBus
Parameters:
handlerID - id of the UIHandler which is received when registering to the IUIBus. It must be passed to the bus when calling bus methods.
user - human User. It is declared as Resource because the type User is defined in the Profiling Ontology. The type is not needed for for matchmaking Either.
loginLocation - login Location of the User

handleSendError

public void handleSendError(ChannelMessage message,
                            CommunicationConnectorException e)
Description copied from interface: MessageListener
Callback for error handling

Specified by:
handleSendError in interface MessageListener

getMatchingProfiles

public UIHandlerProfile[] getMatchingProfiles(String modalityRegex)
Returns list of UIHandlerProfiles that match the given expression

Specified by:
getMatchingProfiles in interface IUIBus
Parameters:
modalityRegex - - regular expression used for matching UIHandlerProfiles modalities
Returns:
Array of matched UIHandlerProfiles


Copyright © 2014 universAAL Consortium. All Rights Reserved.