org.araneaframework.core
Class RelocatableDecorator

java.lang.Object
  extended byorg.araneaframework.core.BaseComponent
      extended byorg.araneaframework.core.BaseService
          extended byorg.araneaframework.core.RelocatableDecorator
All Implemented Interfaces:
ApplicationComponent, ApplicationService, ApplicationWidget, Component, Composite, Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget, Relocatable, Relocatable.RelocatableComponent, Relocatable.RelocatableService, Relocatable.RelocatableWidget, Serializable, Service, Viewable, Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget, Widget

public class RelocatableDecorator
extends BaseService
implements Serializable, Relocatable.RelocatableService, Relocatable.RelocatableWidget, ApplicationService, ApplicationWidget

A decorator to make a service relocatable. A relocatable service can be moved from one parent to another, and the relocatable service will have access to the right Environment. The Environment of the decorator is swappable.

Author:
"Toomas Römer" , Jevgeni Kabanov (ekabanov at araneaframework dot org)
See Also:
Serialized Form

Nested Class Summary
protected  class RelocatableDecorator.RelocatableComponentImpl
           
 
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.Relocatable
Relocatable.Interface, Relocatable.RelocatableComponent, Relocatable.RelocatableService, Relocatable.RelocatableWidget
 
Nested classes inherited from class org.araneaframework.Component
Component.Interface
 
Nested classes inherited from class org.araneaframework.Service
Service.Interface
 
Nested classes inherited from class org.araneaframework.Widget
Widget.Interface
 
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.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.core.ApplicationWidget
ApplicationWidget.WidgetViewModel
 
Field Summary
protected  Service child
          The child service that is made relocatable.
 
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
 
Fields inherited from interface org.araneaframework.core.ApplicationWidget
EVENT_HANDLER_ID_KEY, EVENT_PARAMETER_KEY, EVENT_PATH_KEY
 
Constructor Summary
RelocatableDecorator(Service child)
          Constructs a new RelocatableDecorator and sets its child service to child.
 
Method Summary
 Composite.Interface _getComposite()
          The factory method returning the implementation of the Composite.
 Relocatable.Interface _getRelocatable()
          This method must provide a Relocatable.Interface that will be used to change the Environment of the relocatable component/service/widget.
 Viewable.Interface _getViewable()
           
 Widget.Interface _getWidget()
           
protected  void action(Path path, InputData input, OutputData output)
          Services provide their services through the action(...) method.
protected  void destroy()
          Destroy callback.
 Environment getChildEnvironment()
          Get the child Environment of this component.
protected  void init()
          Init callback.
protected  void propagate(Message message)
          Forwards the message to the component and to all of its children components.
 void setChildService(Service child)
          Sets the child service of this component.
 
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, disable, enable, getEnvironment, getScope, handleException, 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, getEnvironment, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 

Field Detail

child

protected Service child
The child service that is made relocatable.

Constructor Detail

RelocatableDecorator

public RelocatableDecorator(Service child)
Constructs a new RelocatableDecorator and sets its child service to child.

Parameters:
child - The service that should be relocatable.
Method Detail

_getRelocatable

public Relocatable.Interface _getRelocatable()
Description copied from interface: Relocatable
This method must provide a Relocatable.Interface that will be used to change the Environment of the relocatable component/service/widget.

Specified by:
_getRelocatable in interface Relocatable
Returns:
An implementation of Relocatable.Interface.

setChildService

public void setChildService(Service child)
Sets the child service of this component.

Parameters:
child - The service that should be relocatable.

init

protected void init()
             throws Exception
Description copied from class: BaseComponent
Init callback. Gets called when the component is initilized.

Overrides:
init in class BaseComponent
Throws:
Exception - Any runtime exception that may occur.

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
Description copied from class: BaseService
Services provide their services through the action(...) method. An implementation of a non-composite service like BaseService uses the action method to hook in the middle of the action routing and provide filtering, logging etc.

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.

destroy

protected void destroy()
                throws Exception
Description copied from class: BaseComponent
Destroy callback. Gets called when the component is destroyed.

Overrides:
destroy in class BaseComponent
Throws:
Exception - Any runtime exception that may occur.

getChildEnvironment

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

Specified by:
getChildEnvironment in interface ApplicationComponent

_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

_getWidget

public Widget.Interface _getWidget()
Specified by:
_getWidget in interface Widget