org.teleal.cling.model.action
Class AbstractActionExecutor

java.lang.Object
  extended by org.teleal.cling.model.action.AbstractActionExecutor
All Implemented Interfaces:
ActionExecutor
Direct Known Subclasses:
MethodActionExecutor, QueryStateVariableExecutor

public abstract class AbstractActionExecutor
extends Object
implements ActionExecutor

Shared procedures for action executors based on an actual service implementation instance.

Author:
Christian Bauer

Field Summary
protected  Map<ActionArgument<LocalService>,StateVariableAccessor> outputArgumentAccessors
           
 
Constructor Summary
protected AbstractActionExecutor()
           
protected AbstractActionExecutor(Map<ActionArgument<LocalService>,StateVariableAccessor> outputArgumentAccessors)
           
 
Method Summary
 void execute(ActionInvocation<LocalService> actionInvocation)
          Obtains the service implementation instance from the ServiceManager, handles exceptions.
protected abstract  void execute(ActionInvocation<LocalService> actionInvocation, Object serviceImpl)
           
 Map<ActionArgument<LocalService>,StateVariableAccessor> getOutputArgumentAccessors()
           
protected  Object readOutputArgumentValues(Action<LocalService> action, Object instance)
          Reads the output arguments after an action execution using accessors.
protected  void setOutputArgumentValue(ActionInvocation<LocalService> actionInvocation, ActionArgument<LocalService> argument, Object result)
          Sets the output argument value on the ActionInvocation, considers string conversion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputArgumentAccessors

protected Map<ActionArgument<LocalService>,StateVariableAccessor> outputArgumentAccessors
Constructor Detail

AbstractActionExecutor

protected AbstractActionExecutor()

AbstractActionExecutor

protected AbstractActionExecutor(Map<ActionArgument<LocalService>,StateVariableAccessor> outputArgumentAccessors)
Method Detail

getOutputArgumentAccessors

public Map<ActionArgument<LocalService>,StateVariableAccessor> getOutputArgumentAccessors()

execute

public void execute(ActionInvocation<LocalService> actionInvocation)
Obtains the service implementation instance from the ServiceManager, handles exceptions.

Specified by:
execute in interface ActionExecutor

execute

protected abstract void execute(ActionInvocation<LocalService> actionInvocation,
                                Object serviceImpl)
                         throws Exception
Throws:
Exception

readOutputArgumentValues

protected Object readOutputArgumentValues(Action<LocalService> action,
                                          Object instance)
                                   throws Exception
Reads the output arguments after an action execution using accessors.

Parameters:
action - The action of which the output arguments are read.
instance - The instance on which the accessors will be invoked.
Returns:
null if the action has no output arguments, a single instance if it has one, an Object[] otherwise.
Throws:
Exception

setOutputArgumentValue

protected void setOutputArgumentValue(ActionInvocation<LocalService> actionInvocation,
                                      ActionArgument<LocalService> argument,
                                      Object result)
                               throws ActionException
Sets the output argument value on the ActionInvocation, considers string conversion.

Throws:
ActionException


Copyright © 2011 Teleal GmbH, Switzerland. All Rights Reserved.