org.araneaframework.core
Class BaseApplicationService

java.lang.Object
  extended byorg.araneaframework.core.BaseComponent
      extended byorg.araneaframework.core.BaseService
          extended byorg.araneaframework.core.BaseApplicationService
All Implemented Interfaces:
ApplicationComponent, ApplicationService, Component, Composite, Composite.CompositeComponent, Composite.CompositeService, Serializable, Service, Viewable, Viewable.ViewableComponent, Viewable.ViewableService

public abstract class BaseApplicationService
extends BaseService
implements ApplicationService

A full featured Service with support for composite, eventlisteners, viewmodel.

See Also:
Serialized Form

Nested Class Summary
protected  class BaseApplicationService.CompositeImpl
           
protected  class BaseApplicationService.ViewableImpl
           
 class BaseApplicationService.ViewModel
           
 
Nested classes inherited from class org.araneaframework.core.BaseService
BaseService.ServiceImpl
 
Nested classes inherited from class org.araneaframework.core.BaseComponent
BaseComponent.ComponentImpl
 
Nested classes inherited from class org.araneaframework.core.ApplicationService
ApplicationService.ServiceViewModel
 
Nested classes inherited from class org.araneaframework.core.ApplicationComponent
ApplicationComponent.ComponentViewModel
 
Nested classes inherited from class org.araneaframework.Component
Component.Interface
 
Nested classes inherited from class org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget, Composite.Interface
 
Nested classes inherited from class org.araneaframework.Viewable
Viewable.Interface, Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Nested classes inherited from class org.araneaframework.Service
Service.Interface
 
Field Summary
static String ACTION_ID_ATTRIBUTE
          Deprecated.  
 
Fields inherited from class org.araneaframework.core.BaseService
currentInputData, currentOutputData
 
Fields inherited from interface org.araneaframework.core.ApplicationService
ACTION_HANDLER_ID_KEY, ACTION_PARAMETER_KEY, ACTION_PATH_KEY
 
Constructor Summary
BaseApplicationService()
           
 
Method Summary
 Composite.Interface _getComposite()
          The factory method returning the implementation of the Composite.
 Viewable.Interface _getViewable()
           
protected  void action(Path path, InputData input, OutputData output)
          If path hasNextStep() routes to the correct child, otherwise calls the appropriate listener.
 void addActionListener(Object actionId, ActionListener listener)
          Adds the ActionListener listener with the specified action id.
 void addService(Object key, Service child)
          Adds a service with the specified key.
 void addService(Object key, Service child, Environment env)
          Adds a service with the specified key.
 void clearActionlisteners(Object actionId)
          Clears all the ActionListeners with the specified actionId.
 void disableService(Object key)
          Disables the service with the specified key.
 void enableService(Object key)
          Enables the service with the specified key.
protected  Object getActionId(InputData input)
          Returns the id of the action based on the input.
 Environment getChildEnvironment()
          Get the child Environment of this component.
 Map getChildren()
          Returns an unmodifiable map of the children.
protected  Environment getChildServiceEnvironment()
          Returns the the Environment of this Service by default.
 Environment getEnvironment()
          Provides access to the Environment of this Component.
protected  Object getViewModel()
          Returns the view model.
protected  void handleAction(InputData input, OutputData output)
          Calls the approriate listener
protected  void propagate(Message message)
          Forwards the message to the component and to all of its children components.
 void putViewData(String key, Object customDataItem)
          Adds custom data to the widget view model (${widget.custom['key']}).
 void relocateService(Composite parent, Environment newEnv, Object keyFrom, Object keyTo)
          Relocates parent's child with keyFrom to this service with a new key keyTo.
 void relocateService(Composite parent, Object keyFrom, Object keyTo)
          Relocates parent's child with keyFrom to this service with a new key keyTo.
 void removeActionListener(ActionListener listener)
          Removes the ActionListener listener from this component.
 void removeService(Object key)
          Removes the service with the specified key.
 void removeViewData(String key)
          Removes the custom data under key.
 
Methods inherited from class org.araneaframework.core.BaseService
_getService, getInputData, getOutputData, handleServiceException
 
Methods inherited from class org.araneaframework.core.BaseComponent
_addComponent, _addComponent, _checkCall, _disableComponent, _enableComponent, _endCall, _endWaitingCall, _getChildren, _getComponent, _getDisabledChildren, _propagate, _relocateComponent, _removeComponent, _setEnvironment, _setScope, _startCall, _startWaitingCall, _strictCheckCall, _strictStartCall, _waitNoCall, destroy, disable, enable, getScope, handleException, init, isAlive, isDead, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 

Field Detail

ACTION_ID_ATTRIBUTE

public static final String ACTION_ID_ATTRIBUTE
Deprecated.  

The attribute of the action id.

See Also:
Constant Field Values
Constructor Detail

BaseApplicationService

public BaseApplicationService()
Method Detail

_getComposite

public Composite.Interface _getComposite()
Description copied from interface: Composite
The factory method returning the implementation of the Composite.

Specified by:
_getComposite in interface Composite
Returns:
the Composite implementation

_getViewable

public Viewable.Interface _getViewable()
Specified by:
_getViewable in interface Viewable

addActionListener

public void addActionListener(Object actionId,
                              ActionListener listener)
Adds the ActionListener listener with the specified action id.


removeActionListener

public void removeActionListener(ActionListener listener)
Removes the ActionListener listener from this component.


clearActionlisteners

public void clearActionlisteners(Object actionId)
Clears all the ActionListeners with the specified actionId.

Parameters:
actionId - the id of the ActionListeners.

putViewData

public void putViewData(String key,
                        Object customDataItem)
Adds custom data to the widget view model (${widget.custom['key']}). This data will be available until explicitly removed with removeViewData(String).


removeViewData

public void removeViewData(String key)
Removes the custom data under key.


getChildren

public Map getChildren()
Returns an unmodifiable map of the children.


addService

public void addService(Object key,
                       Service child,
                       Environment env)
Adds a service with the specified key. Allready initilized services cannot be added. Duplicate keys not allowed. The child is initialized with the Environment env.


addService

public void addService(Object key,
                       Service child)
Adds a service with the specified key. Allready initilized services cannot be added. Duplicate keys not allowed. The child is initialized with the Environment from getChildServiceEnvironment().


removeService

public void removeService(Object key)
Removes the service with the specified key.


relocateService

public void relocateService(Composite parent,
                            Environment newEnv,
                            Object keyFrom,
                            Object keyTo)
Relocates parent's child with keyFrom to this service with a new key keyTo. The child will get the Environment specified by newEnv.

Parameters:
parent - is the current parent of the child to be relocated.
newEnv - the new Environment of the child.
keyFrom - is the key of the child to be relocated.
keyTo - is the the key, with which the child will be added to this StandardService.

relocateService

public void relocateService(Composite parent,
                            Object keyFrom,
                            Object keyTo)
Relocates parent's child with keyFrom to this service with a new key keyTo. The child will get the Environment of this StandardService.

Parameters:
parent - is the current parent of the child to be relocated.
keyFrom - is the key of the child to be relocated.
keyTo - is the the key, with which the child will be added to this StandardService.

enableService

public void enableService(Object key)
Enables the service with the specified key. Only a disabled service can be enabled.


disableService

public void disableService(Object key)
Disables the service with the specified key. Only a enabled service can be disabled. A disabled service does not get any actions routed to them.


getEnvironment

public Environment getEnvironment()
Description copied from interface: Component
Provides access to the Environment of this Component.

Specified by:
getEnvironment in interface Component
Overrides:
getEnvironment in class BaseComponent

getChildEnvironment

public Environment getChildEnvironment()
Description copied from interface: ApplicationComponent
Get the child Environment of this component.

Specified by:
getChildEnvironment in interface ApplicationComponent

getViewModel

protected Object getViewModel()
                       throws Exception
Returns the view model. Usually overridden.

Throws:
Exception

getChildServiceEnvironment

protected Environment getChildServiceEnvironment()
                                          throws Exception
Returns the the Environment of this Service by default. Usually overridden.

Throws:
Exception

getActionId

protected Object getActionId(InputData input)
Returns the id of the action based on the input. Uses the ACTION_HANDLER_ID_KEY key to extract it from InputData's global data.


propagate

protected void propagate(Message message)
                  throws Exception
Description copied from class: BaseComponent
Forwards the message to the component and to all of its children components.

Overrides:
propagate in class BaseComponent
Parameters:
message - A message to forward.
Throws:
Exception - Any runtime exception that may occur.

action

protected void action(Path path,
                      InputData input,
                      OutputData output)
               throws Exception
If path hasNextStep() routes to the correct child, otherwise calls the appropriate listener.

Overrides:
action in class BaseService
Parameters:
path - The path of the component to whom the action is targeted.
input - The request data.
output - The response data.
Throws:
Exception - Any runtime exception that may occur.

handleAction

protected void handleAction(InputData input,
                            OutputData output)
                     throws Exception
Calls the approriate listener

Throws:
Exception