org.universAAL.middleware.api.impl
Class ServiceCalleeWrapper

Package class diagram package ServiceCalleeWrapper
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.middleware.api.impl.ServiceCalleeWrapper

public class ServiceCalleeWrapper
extends ServiceCallee

Basic class for wrapping ServiceCallee. It acts as a proxy for actual implementation which was annotated by UniversAALService annotation. During handleCall it invokes original service by reflection and create proper ServiceResponse object.

Author:
dzmuda

Field Summary
 
Fields inherited from class org.universAAL.middleware.bus.member.BusMember
busResourceURI, owner, theBus
 
Constructor Summary
ServiceCalleeWrapper(ModuleContext context, ServiceProfile[] realizedServices, Object wrappedObject, String namespace, String serviceURI, Map<String,Method> annotatedMethods, Map<String,List<String>> annotatedOutputNames, Map<String,List<Output>> annotatedOutputs, Map<String,List<String>> annotatedMethodsParametersNames, Map<String,List<Input>> annotatedMethodsParameters)
           
 
Method Summary
 void communicationChannelBroken()
          This abstract method is called for each member of the bus when the bus is being stopped.
 ServiceProfile[] getProfiles()
           
 ServiceResponse handleCall(ServiceCall call)
          Handles the incoming ServiceCall and check if it fits to methods declared by wrapped object.
 void setProfiles(ServiceProfile[] profiles)
           
 
Methods inherited from class org.universAAL.middleware.service.ServiceCallee
addNewServiceProfiles, busDyingOut, 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

ServiceCalleeWrapper

public ServiceCalleeWrapper(ModuleContext context,
                            ServiceProfile[] realizedServices,
                            Object wrappedObject,
                            String namespace,
                            String serviceURI,
                            Map<String,Method> annotatedMethods,
                            Map<String,List<String>> annotatedOutputNames,
                            Map<String,List<Output>> annotatedOutputs,
                            Map<String,List<String>> annotatedMethodsParametersNames,
                            Map<String,List<Input>> annotatedMethodsParameters)
Method Detail

communicationChannelBroken

public void communicationChannelBroken()
Description copied from class: ServiceCallee
This abstract method is called for each member of the bus when the bus is being stopped.

Specified by:
communicationChannelBroken in class ServiceCallee

handleCall

public ServiceResponse handleCall(ServiceCall call)
Handles the incoming ServiceCall and check if it fits to methods declared by wrapped object. If so, it invoke such method with reflection and create proper ServiceResponse It is crucial to remember that Output in ServiceResponse has to be either List or RDF object because TypeMapper.asLiteral does not support other types. If output is an Array it is automatically converted into a List.

Specified by:
handleCall in class ServiceCallee
Parameters:
call - the call that needs to be serviced.
Returns:
the result of the call execution.
See Also:
ServiceCallee.handleCall(org.universAAL.middleware.service.ServiceCall)

setProfiles

public void setProfiles(ServiceProfile[] profiles)

getProfiles

public ServiceProfile[] getProfiles()


Copyright © 2014 universAAL Consortium. All Rights Reserved.