org.universAAL.middleware.service
Class ServiceResponse

Package class diagram package ServiceResponse
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.service.ServiceResponse
All Implemented Interfaces:
Response, UtilityReply
Direct Known Subclasses:
AapiServiceResponse

public class ServiceResponse
extends FinalizedResource
implements Response, UtilityReply

A class that represents a service response resource, which is produced by the ServiceCallee-s when handling calls, and are delivered to the ServiceCaller-s as a result of their requests.

Author:
mtazari - Saied Tazari

Field Summary
static String MY_URI
          A resource URI that specifies the resource as a service response.
static String PROP_SERVICE_CALL_STATUS
          A property key for the property where the status of the call is stored.
static String PROP_SERVICE_HAS_OUTPUT
          A property key for the property where the service outputs are stored.
static String PROP_SERVICE_SPECIFIC_ERROR
          A property key for the property where any errors occurred during the service invocation are stored.
static String PROP_UNBOUND_OUTPUT_ALLOWED
          A key of property indicating that not bound output is allowed.
 
Fields inherited from class org.universAAL.middleware.rdf.Resource
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, ns_delim_index, PROP_RDF_FIRST, PROP_RDF_REST, PROP_RDF_TYPE, PROP_RDFS_COMMENT, PROP_RDFS_LABEL, PROP_SERIALIZATION_FULL, PROP_SERIALIZATION_OPTIONAL, PROP_SERIALIZATION_REDUCED, PROP_SERIALIZATION_UNDEFINED, PROP_uAAL_INVOLVED_HUMAN_USER, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uAAL_NAMESPACE_PREFIX, uAAL_SERVICE_NAMESPACE, uAAL_VOCABULARY_NAMESPACE, uri
 
Constructor Summary
ServiceResponse()
          Default constructor for the class.
ServiceResponse(CallStatus status)
          Constructor which besides the URI, sets the status of the call.
ServiceResponse(String uri)
          Constructor for the class.
 
Method Summary
 void addOutput(ProcessOutput output)
          Adds output payload to this object.
protected  void allowUnboundOutput()
           
protected  void disallowUnboundOutput()
           
 CallStatus getCallStatus()
          Retrieves the call status.
 List getOutput(String paramURI, boolean asMergedList)
          Returns all value objects returned for a required output with the given paramURI.
 List getOutputs()
          Retrieves all of the service outputs as a raw List without any rearranging.
 boolean isUnboundOutputAllowed()
           
 boolean isWellFormed()
          Tests the object for correctness by verifying the presence of PROP_SERVICE_CALL_STATUS property.
 boolean setProperty(String propURI, Object value)
          This method inherits the superclass behavior, but performs some additional checks for correctness of the property values, specific for the ServiceResponse.
 
Methods inherited from class org.universAAL.middleware.rdf.FinalizedResource
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
 
Methods inherited from class org.universAAL.middleware.rdf.Resource
addMultiLangProp, asList, asList, asRDFList, changeProperty, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getPropSerializationType, getResource, getResourceComment, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MY_URI

public static final String MY_URI
A resource URI that specifies the resource as a service response.

See Also:
Constant Field Values

PROP_SERVICE_CALL_STATUS

public static final String PROP_SERVICE_CALL_STATUS
A property key for the property where the status of the call is stored.

See Also:
Constant Field Values

PROP_SERVICE_HAS_OUTPUT

public static final String PROP_SERVICE_HAS_OUTPUT
A property key for the property where the service outputs are stored.

See Also:
Constant Field Values

PROP_SERVICE_SPECIFIC_ERROR

public static final String PROP_SERVICE_SPECIFIC_ERROR
A property key for the property where any errors occurred during the service invocation are stored.

See Also:
Constant Field Values

PROP_UNBOUND_OUTPUT_ALLOWED

public static final String PROP_UNBOUND_OUTPUT_ALLOWED
A key of property indicating that not bound output is allowed.

See Also:
Constant Field Values
Constructor Detail

ServiceResponse

public ServiceResponse()
Default constructor for the class. Only sets the class URI of the Resource to MY_URI.


ServiceResponse

public ServiceResponse(String uri)
Constructor for the class.


ServiceResponse

public ServiceResponse(CallStatus status)
Constructor which besides the URI, sets the status of the call.

Parameters:
status - the current status of the call.
Method Detail

allowUnboundOutput

protected void allowUnboundOutput()

disallowUnboundOutput

protected void disallowUnboundOutput()

isUnboundOutputAllowed

public boolean isUnboundOutputAllowed()

addOutput

public void addOutput(ProcessOutput output)
Adds output payload to this object. Keeps any output payload that was previously added.

Parameters:
output - the ouput that needs to be added.

getCallStatus

public CallStatus getCallStatus()
Retrieves the call status.

Returns:
the current call status.

getOutput

public List getOutput(String paramURI,
                      boolean asMergedList)
Returns all value objects returned for a required output with the given paramURI. Since the original request might have been responded by several different service components, asMergedList decides if those responses are returned separately or merged into one list. A return value of null indicates that there are no outputs in the response. If an empty list is returned by this method, it indicates that there are no output related to the given paramURI. Otherwise, the return value is always a list even if there is only one value object in that list.

Parameters:
paramURI - the URI of the required output.
asMergedList - specifies if the outputs of the separate services are merged.
Returns:
the output with the specified URI.

getOutputs

public List getOutputs()
Retrieves all of the service outputs as a raw List without any rearranging.

Returns:
the outputs that the invoked services produced.

isWellFormed

public boolean isWellFormed()
Tests the object for correctness by verifying the presence of PROP_SERVICE_CALL_STATUS property.

Overrides:
isWellFormed in class Resource
See Also:
Resource.isWellFormed()

setProperty

public boolean setProperty(String propURI,
                           Object value)
This method inherits the superclass behavior, but performs some additional checks for correctness of the property values, specific for the ServiceResponse.

Overrides:
setProperty in class Resource
Returns:
true if the property changed as a result of the call
See Also:
Resource.setProperty(java.lang.String, java.lang.Object)


Copyright © 2014 universAAL Consortium. All Rights Reserved.