|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.universAAL.middleware.bus.member.BusMember
org.universAAL.middleware.bus.member.Caller
org.universAAL.middleware.service.ServiceCaller
public abstract class ServiceCaller
/** This is an abstract class that the service caller members of the service
bus must derive from. Any ServiceCaller
must incorporate the
logic of handling service responses into the implementation of the abstract
method handleResponse(String, ServiceResponse)
.
Field Summary |
---|
Fields inherited from class org.universAAL.middleware.bus.member.BusMember |
---|
busResourceURI, owner, theBus |
Constructor Summary | |
---|---|
protected |
ServiceCaller(ModuleContext context)
The default constructor for this class. |
Method Summary | |
---|---|
void |
addAvailabilitySubscription(AvailabilitySubscriber subscriber,
ServiceRequest request)
Adds an availability subscription, in other words a listener, to receive events about the availability of a specified service. |
void |
busDyingOut(AbstractBus b)
This method is called when the bus is stopped to announce this to the bus members. |
ServiceResponse |
call(ServiceRequest request)
The "normal" (synchronous) way of calling a service. |
ServiceResponse |
call(String request)
This method is a way of calling a service using Turtle Strings as input. |
abstract void |
communicationChannelBroken()
This abstract method is called for each member of the bus when the bus is being stopped. |
ServiceProfile[] |
getAllServices()
A method used to instantly retrieve all services available to this caller. |
ServiceProfile[] |
getMatchingService(Service s)
A method used to retrieve a specified service, available to this ServiceCaller . |
ServiceProfile[] |
getMatchingService(String serviceClassURI)
A method used to retrieve a specified service, available to this ServiceCaller . |
ServiceProfile[] |
getMatchingService(String[] keywords)
A method used to retrieve a service available to this caller, that matches the specified keywords. |
String |
getMyID()
|
void |
handleReply(BusMessage m)
|
abstract void |
handleResponse(String reqID,
ServiceResponse response)
Will be called automatically in a new thread whenever the response corresponding to a previous call to sendRequest(ServiceRequest)
is ready. |
void |
removeAvailabilitySubscription(AvailabilitySubscriber subscriber,
String requestURI)
Removes an availability subscription for this Caller , which
was previously added using addAvailabilitySubscription
method. |
String |
sendRequest(ServiceRequest request)
To be used if the caller would like to handle the reply asynchronously within the method handleResponse(String, ServiceResponse) , which
will automatically be called in another thread when the response is
ready. |
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 |
---|
protected ServiceCaller(ModuleContext context)
context
- The module context where the ServiceBus
is registered.
Note that if no service bus is registered within the passed
ModuleContext
at the time of creation, this
object will not be operational.Method Detail |
---|
public final void busDyingOut(AbstractBus b)
BusMember
busDyingOut
in class BusMember
b
- bus on which this member has been registeredBusMember.busDyingOut(AbstractBus)
public ServiceResponse call(ServiceRequest request)
sendRequest(ServiceRequest)
, if you want to handle the response
asynchronously in another thread.
NullPointerException
- if request is nullpublic final ServiceResponse call(String request)
request
- the Turtle String which will be converted into
ServiceRequest
public abstract void communicationChannelBroken()
public final void handleReply(BusMessage m)
public abstract void handleResponse(String reqID, ServiceResponse response)
sendRequest(ServiceRequest)
is ready.
reqID
- the ID returned by the previous call to
sendRequest(ServiceRequest)
.response
- the expected response.public final String sendRequest(ServiceRequest request)
handleResponse(String, ServiceResponse)
, which
will automatically be called in another thread when the response is
ready.
handleResponse(String, ServiceResponse)
for an
unambiguous mapping of responses to requests. Returns null, if
this caller does not have the permission for the given request
NullPointerException
- if the request is nullpublic ServiceProfile[] getAllServices()
public ServiceProfile[] getMatchingService(Service s)
ServiceCaller
.
s
- the desired service.
public ServiceProfile[] getMatchingService(String serviceClassURI)
ServiceCaller
.
serviceClassURI
- the class URI of the desired service.
public ServiceProfile[] getMatchingService(String[] keywords)
keywords
- the keywords that should be matched by the service.
public void addAvailabilitySubscription(AvailabilitySubscriber subscriber, ServiceRequest request)
subscriber
- the object which will receive events when the appropriate
service registers or unregisters.request
- the request that describes the desired service.public void removeAvailabilitySubscription(AvailabilitySubscriber subscriber, String requestURI)
Caller
, which
was previously added using addAvailabilitySubscription
method.
subscriber
- the object which used to receive the events.requestURI
- the service that was being monitored.public String getMyID()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |