org.universAAL.support.utils.service.mid
Class UtilActuator

Package class diagram package UtilActuator
java.lang.Object
  extended by org.universAAL.support.utils.service.mid.UtilActuator

public class UtilActuator
extends Object

This is a helper class for those who want to use the typical services of an on/off actuator (get status, set on and off) over an ontological service. It provides methods for automatically generating service profiles and service requests that can be used in ServiceCallees and ServiceCallers. If they are both with the same parameters in both sides, the services are guaranteed to match.

Author:
alfiva

Field Summary
static String IN_DEVICE
          Argument suffix.
static String OUT_GET_ON_OFF
          Argument suffix.
static String SERVICE_GET_ON_OFF
          Service suffix.
static String SERVICE_TURN_OFF
          Service suffix.
static String SERVICE_TURN_ON
          Service suffix.
 
Constructor Summary
UtilActuator()
           
 
Method Summary
static ServiceProfile[] getServiceProfiles(String namespace, Actuator actuator)
          Gives you the 3 typical service profiles of an on/off actuator service: Get status, Set On, and Set Off.
static ServiceProfile[] getServiceProfiles(String namespace, String ontologyURI, Actuator actuator)
          Gives you the 3 typical service profiles of an on/off actuator service: Get status, Set On, and Set Off.
static ServiceRequest requestGetOnOff(Actuator actuator, String out)
          Gives you the typical GET STATUS service request for actuator services.
static ServiceRequest requestGetOnOff(String ontologyURI, Actuator actuator, String out)
          Gives you the typical GET STATUS service request for actuator services.
static ServiceRequest requestGetOnOff(String ontologyURI, Variable argIn, Output argOut)
          Gives you the typical GET STATUS service request for actuator services.
static ServiceRequest requestSetOff(Actuator actuator)
          Gives you the typical SET OFF service request for actuator services.
static ServiceRequest requestSetOff(String ontologyURI, Actuator actuator)
          Gives you the typical SET OFF service request for actuator services.
static ServiceRequest requestSetOff(String ontologyURI, Variable argIn)
          Gives you the typical SET OFF service request for actuator services.
static ServiceRequest requestSetOn(Actuator actuator)
          Gives you the typical SET ON service request for actuator services.
static ServiceRequest requestSetOn(String ontologyURI, Actuator actuator)
          Gives you the typical SET ON service request for actuator services.
static ServiceRequest requestSetOn(String ontologyURI, Variable argIn)
          Gives you the typical SET ON service request for actuator services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_GET_ON_OFF

public static final String SERVICE_GET_ON_OFF
Service suffix.

See Also:
Constant Field Values

OUT_GET_ON_OFF

public static final String OUT_GET_ON_OFF
Argument suffix.

See Also:
Constant Field Values

SERVICE_TURN_OFF

public static final String SERVICE_TURN_OFF
Service suffix.

See Also:
Constant Field Values

SERVICE_TURN_ON

public static final String SERVICE_TURN_ON
Service suffix.

See Also:
Constant Field Values

IN_DEVICE

public static final String IN_DEVICE
Argument suffix.

See Also:
Constant Field Values
Constructor Detail

UtilActuator

public UtilActuator()
Method Detail

getServiceProfiles

public static ServiceProfile[] getServiceProfiles(String namespace,
                                                  String ontologyURI,
                                                  Actuator actuator)
                                           throws InvalidOntologyUtilException
Gives you the 3 typical service profiles of an on/off actuator service: Get status, Set On, and Set Off. When handling requests in your Callee, you can use the references to services and arguments URIs prepending namespace to UtilActuator constants.

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

Example:

new SCallee(context, getServiceProfiles("http://ontology.universAAL.org/OvenServer.owl#", OvenService.MY_URI, myOvenDevice))

Parameters:
namespace - The namespace of your server, ending with the character #. You can optionally add some prefix after the # if you use UtilActuator more than once in the same Callee.
ontologyURI - The MY_URI of the class of DeviceService ontology you are going to implement. It MUST be a subclass of DeviceService.
actuator - The ontology instance of the actuator you are controlling. The more properties it has set, the better.
Returns:
An array with the 3 typical service profiles
Throws:
InvalidOntologyUtilException - when an actuator is passed that is does not have StatusValue as type restriction of its HAS_VALUE property.

getServiceProfiles

public static ServiceProfile[] getServiceProfiles(String namespace,
                                                  Actuator actuator)
                                           throws InvalidOntologyUtilException
Gives you the 3 typical service profiles of an on/off actuator service: Get status, Set On, and Set Off. When handling requests in your Callee, you can use the references to services and arguments URIs prepending namespace to UtilActuator constants. The service is treated as the default DeviceService, in case you don't have a specific service ontology for the type of actuator you are handling.

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

Parameters:
namespace - The namespace of your server, ending with the character #. You can optionally add some prefix after the # if you use UtilActuator more than once in the same Callee.
actuator - The ontology instance of the actuator you are controlling. The more properties it has set, the better.
Returns:
An array with the 3 typical service profiles
Throws:
InvalidOntologyUtilException - when an actuator is passed that is does not have StatusValue as type restriction of its HAS_VALUE property

requestGetOnOff

public static ServiceRequest requestGetOnOff(String ontologyURI,
                                             Variable argIn,
                                             Output argOut)
Gives you the typical GET STATUS service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
argIn - Value representing the input you want to pass as parameter. The actuator GET service will be called for this specific actuator.
argOut - The returned value of the actuator GET service will be placed in the URI represented by this Output. Look for it there in the response.
Returns:
The ServiceRequest that will call the matching GET STATUS service of an actuator

requestGetOnOff

public static ServiceRequest requestGetOnOff(String ontologyURI,
                                             Actuator actuator,
                                             String out)
Gives you the typical GET STATUS service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
actuator - The ontology instance of the actuator you want to get the status from.
out - The returned value of the actuator GET service will be placed in the URI represented by this String. Look for it there in the response.
Returns:
The ServiceRequest that will call the matching GET STATUS service of an actuator

requestGetOnOff

public static ServiceRequest requestGetOnOff(Actuator actuator,
                                             String out)
Gives you the typical GET STATUS service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
actuator - The ontology instance of the actuator you want to get the status from.
out - The returned value of the actuator GET service will be placed in the URI represented by this String. Look for it there in the response.
Returns:
The ServiceRequest that will call the matching GET STATUS service of an actuator

requestSetOn

public static ServiceRequest requestSetOn(String ontologyURI,
                                          Variable argIn)
Gives you the typical SET ON service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
argIn - Value representing the input you want to pass as parameter. The actuator SET ON service will be called for this specific actuator.
Returns:
The ServiceRequest that will call the matching SET ON service of an actuator

requestSetOn

public static ServiceRequest requestSetOn(String ontologyURI,
                                          Actuator actuator)
Gives you the typical SET ON service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
actuator - The ontology instance of the actuator you want to set on.
Returns:
The ServiceRequest that will call the matching SET ON service of an actuator

requestSetOn

public static ServiceRequest requestSetOn(Actuator actuator)
Gives you the typical SET ON service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
actuator - The ontology instance of the actuator you want to set on.
Returns:
The ServiceRequest that will call the matching SET ON service of an actuator

requestSetOff

public static ServiceRequest requestSetOff(String ontologyURI,
                                           Variable argIn)
Gives you the typical SET OFF service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
argIn - Value representing the input you want to pass as parameter. The actuator SET OFF service will be called for this specific actuator.
Returns:
The ServiceRequest that will call the matching SET OFF service of an actuator

requestSetOff

public static ServiceRequest requestSetOff(String ontologyURI,
                                           Actuator actuator)
Gives you the typical SET OFF service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
actuator - The ontology instance of the actuator you want to set off.
Returns:
The ServiceRequest that will call the matching SET OFF service of an actuator

requestSetOff

public static ServiceRequest requestSetOff(Actuator actuator)
Gives you the typical SET OFF service request for actuator services. If the editor service also used UtilActuator the match is guaranteed.

Parameters:
actuator - The ontology instance of the actuator you want to set off.
Returns:
The ServiceRequest that will call the matching SET OFF service of an actuator


Copyright © 2014 universAAL Consortium. All Rights Reserved.