org.universAAL.middleware.service.impl
Class ServiceRealization

Package class diagram package ServiceRealization
java.lang.Object
  extended by org.universAAL.middleware.rdf.Resource
      extended by org.universAAL.middleware.rdf.FinalizedResource
          extended by org.universAAL.middleware.service.impl.ServiceRealization

public class ServiceRealization
extends FinalizedResource

The realization of a service to be passed to the service bus as registration parameter. The ServiceRealization is a resource that has ServiceCalle, ServiceProfile, response times, QoS rankings as properties.

Author:
mtazari - Saied Tazari

Field Summary
static String MY_URI
           
static String uAAL_ASSERTED_SERVICE_CALL
           
static String uAAL_SERVICE_PROFILE
           
static String uAAL_SERVICE_PROVIDER
           
static String uAAL_SERVICE_QUALITY_OF_SERVICE
           
static String uAAL_SERVICE_RESPONSE_TIME
           
static String uAAL_SERVICE_URI_MATCHED
          This constant is used for indicating that service has matched exactly the URI specified in the Service Request.
 
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
ServiceRealization()
           
ServiceRealization(String instanceURI)
           
ServiceRealization(String theCallee, ServiceProfile theProfile)
           
 
Method Summary
 Rating getAvgQoSRating()
          Returns average Quality of Service rating of this ServiceRealization
 int getAvgResponseTime()
          Returns average response time of the measured response times for this ServiceRealization
 Rating getMaxQoSRating()
          Returns maximal Quality of Service rating of this ServiceRealization
 int getMaxResponseTime()
          Returns maximal response time of the measured response times for this ServiceRealization
 Rating getMinQoSRating()
          Returns minimal Quality of Service rating of this ServiceRealization
 int getMinResponseTime()
          Returns minimal response time of the measured response times for this ServiceRealization
 int getNumberOfQoSRatings()
          Returns number of Quality of Service ratings of this ServiceRealization
 int getNumberOfResponseTimeMeasurements()
          Returns number of the measured response times for this ServiceRealization
 int getPropSerializationType(String propURI)
          Answers if the given property has to be considered when serializing this individual in a minimized way, and if not ignore-able, whether its value should be presented in its full form or can be reduced.
 int getResponseTimeout()
          Return the declared response timeout of the ServiceProfile related to this realization
 boolean isWellFormed()
          Returns true, if the state of the resource is valid, otherwise false.
 boolean matches(ServiceRequest request, HashMap context, Long logID)
          Return true if the ServiceRequest matches this ServiceRealization + Context
 boolean matches(String word)
          Return true iff the string passed as a parameter matches this ServiceRealization
 boolean matchesAll(String[] keywords)
          Return true iff all the strings in the array of Strings passed as a parameter match this ServiceRealization
 boolean matchesOne(String[] keywords)
          Return true iff one of the strings in the array of Strings passed as a parameter matches this ServiceRealization
 boolean setProperty(String propURI, Object value)
          Adds a statement with this resource as the subject, the given propURI as the predicate and the given value as the object.
 
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, 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
See Also:
Constant Field Values

uAAL_SERVICE_RESPONSE_TIME

public static final String uAAL_SERVICE_RESPONSE_TIME
See Also:
Constant Field Values

uAAL_SERVICE_QUALITY_OF_SERVICE

public static final String uAAL_SERVICE_QUALITY_OF_SERVICE
See Also:
Constant Field Values

uAAL_SERVICE_PROVIDER

public static final String uAAL_SERVICE_PROVIDER
See Also:
Constant Field Values

uAAL_SERVICE_PROFILE

public static final String uAAL_SERVICE_PROFILE
See Also:
Constant Field Values

uAAL_ASSERTED_SERVICE_CALL

public static final String uAAL_ASSERTED_SERVICE_CALL
See Also:
Constant Field Values

uAAL_SERVICE_URI_MATCHED

public static final String uAAL_SERVICE_URI_MATCHED
This constant is used for indicating that service has matched exactly the URI specified in the Service Request.

See Also:
Constant Field Values
Constructor Detail

ServiceRealization

public ServiceRealization()

ServiceRealization

public ServiceRealization(String theCallee,
                          ServiceProfile theProfile)

ServiceRealization

public ServiceRealization(String instanceURI)
Method Detail

getAvgQoSRating

public Rating getAvgQoSRating()
Returns average Quality of Service rating of this ServiceRealization

Returns:
Rating - the average rating

getAvgResponseTime

public int getAvgResponseTime()
Returns average response time of the measured response times for this ServiceRealization

Returns:
int - the average response time

getMaxQoSRating

public Rating getMaxQoSRating()
Returns maximal Quality of Service rating of this ServiceRealization

Returns:
Rating - the maximal rating

getMaxResponseTime

public int getMaxResponseTime()
Returns maximal response time of the measured response times for this ServiceRealization

Returns:
int - the maximal response time

getMinQoSRating

public Rating getMinQoSRating()
Returns minimal Quality of Service rating of this ServiceRealization

Returns:
Rating - the minimal rating

getMinResponseTime

public int getMinResponseTime()
Returns minimal response time of the measured response times for this ServiceRealization

Returns:
int - the minimal response time

getNumberOfQoSRatings

public int getNumberOfQoSRatings()
Returns number of Quality of Service ratings of this ServiceRealization

Returns:
int - the number of QoSRatings

getNumberOfResponseTimeMeasurements

public int getNumberOfResponseTimeMeasurements()
Returns number of the measured response times for this ServiceRealization

Returns:
int - the number of measurements

getResponseTimeout

public int getResponseTimeout()
Return the declared response timeout of the ServiceProfile related to this realization

Returns:
int - the response timeout

matches

public boolean matches(ServiceRequest request,
                       HashMap context,
                       Long logID)
Return true if the ServiceRequest matches this ServiceRealization + Context

Parameters:
request - - the ServiceRequest to match
context - - the Context to match
logID - - an id to be used for logging, may be null
Returns:
true, if the service request matches.

matches

public boolean matches(String word)
Return true iff the string passed as a parameter matches this ServiceRealization

Parameters:
word - - the string to match
Returns:
- true iff the string passed as a parameter matches

matchesAll

public boolean matchesAll(String[] keywords)
Return true iff all the strings in the array of Strings passed as a parameter match this ServiceRealization

Parameters:
keywords - - the array of Strings to match
Returns:
- true iff all the strings match

matchesOne

public boolean matchesOne(String[] keywords)
Return true iff one of the strings in the array of Strings passed as a parameter matches this ServiceRealization

Parameters:
keywords - - the array of Strings to match
Returns:
- true iff one of the strings matches

getPropSerializationType

public int getPropSerializationType(String propURI)
Description copied from class: Resource
Answers if the given property has to be considered when serializing this individual in a minimized way, and if not ignore-able, whether its value should be presented in its full form or can be reduced. The return value must be one of Resource.PROP_SERIALIZATION_OPTIONAL, Resource.PROP_SERIALIZATION_REDUCED, or Resource.PROP_SERIALIZATION_FULL. It can be assumed that the given property is one of those returned by Resource.getPropertyURIs().
Decision criterion should be if the value of this property is absolutely necessary when this resource is being sent to a remote node. If the subclass rates it as unlikely that the receiver side would need this info, the answer should be PROP_SERIALIZATION_OPTIONAL in favor of lower communication traffic and higher performance even at risk of a possible additional query on the receiver side for fetching this info. With the same rationale, if a property should be included in the process of serialization, it is preferable to include it in a reduced form; in this case the return value should be PROP_SERIALIZATION_REDUCED, otherwise PROP_SERIALIZATION_FULL can be returned. Subclasses should normally overwrite this method as this default implementation returns always PROP_SERIALIZATION_FULL.

Overrides:
getPropSerializationType in class Resource
See Also:
Resource.getPropSerializationType(String)

isWellFormed

public boolean isWellFormed()
Description copied from class: Resource
Returns true, if the state of the resource is valid, otherwise false.

Subclasses should overwrite this methods as the default implementation returns always true.

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

setProperty

public boolean setProperty(String propURI,
                           Object value)
Description copied from class: Resource
Adds a statement with this resource as the subject, the given propURI as the predicate and the given value as the object. Subclasses must override this in order to decide if the statement to be added fits the general class constraints. If not, the call of this method should be ignored. For each property only one single call may be made to this method, unless subsequent calls to this method for setting the value of the same property are treated as an update for an update-able property. Multi-valued properties must be set using an instance of List. The differentiation, if a such list should be treated as an rdf:List, can be made with the help of Resource.isClosedCollection(String). The default implementation here accepts all property-value pairs blindly except for rdf:type which is handled if the value is a type URI, a Resource or a java.util.List of them.

Note: The setting of the property rdf:type is being handled by this class via the final methods Resource.addType(String, boolean), Resource.getType(), and Resource.getTypes(). Although these methods give the view of handling type URIs as strings, but in reality the types are stored as direct instances of this class. So, the subclasses should ignore calls for setting rdf:type; if not, then the subclass must pay attention that the value should be a List of direct instances of this class so that (1) the Resource.toString() method returns just the URI and (2) the serializers get no problems with the value. Also, settings via subclasses may be overwritten by this class if a subsequent call to Resource.addType(String, boolean) is made.

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


Copyright © 2014 universAAL Consortium. All Rights Reserved.