org.universAAL.support.utils.service.top
Class UtilActuatorCallee

Package class diagram package UtilActuatorCallee
java.lang.Object
  extended by org.universAAL.middleware.bus.member.BusMember
      extended by org.universAAL.middleware.bus.member.Callee
          extended by org.universAAL.middleware.service.ServiceCallee
              extended by org.universAAL.support.utils.service.top.UtilActuatorCallee
Direct Known Subclasses:
CalleeExample

public abstract class UtilActuatorCallee
extends ServiceCallee

This is an abstract class for those who want to use the typical services of an actuator (get status, set on, set off) over an ontological service. Classes extending this abstract class will be ServiceCallees which handle by default these 3 services. Those considering using UtilActuator could take advantage of this class if they want only to handle those 3 typical services profiles and no more.

Author:
alfiva

Field Summary
 
Fields inherited from class org.universAAL.middleware.bus.member.BusMember
busResourceURI, owner, theBus
 
Constructor Summary
UtilActuatorCallee(ModuleContext context, String namespace, Actuator actuator)
          Default constructor of the class.
 
Method Summary
abstract  boolean executeGet()
          When a GET STATUS service request is received, this method is called automatically.
abstract  boolean executeOff()
          When a SET OFF service request is received, this method is called automatically.
abstract  boolean executeOn()
          When a SET ON service request is received, this method is called automatically.
 ServiceResponse handleCall(ServiceCall call)
          The actual service method of the ServiceCallee.
 
Methods inherited from class org.universAAL.middleware.service.ServiceCallee
addNewServiceProfiles, busDyingOut, communicationChannelBroken, getMyID, handleRequest, removeMatchingProfiles
 
Methods inherited from class org.universAAL.middleware.bus.member.BusMember
close, getType, getURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UtilActuatorCallee

public UtilActuatorCallee(ModuleContext context,
                          String namespace,
                          Actuator actuator)
                   throws InvalidOntologyUtilException
Default constructor of the class. Takes the same parameters needed by a UtilActuator profile method, in addition to the ModuleContext.

BE CAREFUL: This will only work with actuators that have StatusValue as HAS_VALUE property. Others, like DimmerActuator, will throw an exception.

Parameters:
context - The Module Context of uAAL
namespace - The namespace of your server, ending with the character #
actuator - The ontology instance of the actuator you are controlling. The more properties it has set, the better.
Throws:
InvalidOntologyUtilException - when an actuator is passed that is does not have StatusValue as type restriction of its HAS_VALUE property
Method Detail

handleCall

public ServiceResponse handleCall(ServiceCall call)
Description copied from class: ServiceCallee
The actual service method of the ServiceCallee. It is called by the bus whenever there is a call that need to be serviced by this ServiceCallee.

Specified by:
handleCall in class ServiceCallee
Parameters:
call - the call that needs to be serviced.
Returns:
the result of the call execution.

executeOn

public abstract boolean executeOn()
When a SET ON service request is received, this method is called automatically.

Returns:
true if the actuator could be set to ON

executeOff

public abstract boolean executeOff()
When a SET OFF service request is received, this method is called automatically.

Returns:
true if the actuator could be set to OFF

executeGet

public abstract boolean executeGet()
When a GET STATUS service request is received, this method is called automatically.

Returns:
The Boolean value representing the status property of the actuator.


Copyright © 2014 universAAL Consortium. All Rights Reserved.