Class HostedServiceProxyImpl
-
- All Implemented Interfaces:
-
org.somda.sdc.dpws.service.EventSinkAccess,org.somda.sdc.dpws.service.HostedServiceProxy,org.somda.sdc.dpws.soap.RequestResponseClient,org.somda.sdc.dpws.soap.interception.InterceptorHandler
public class HostedServiceProxyImpl implements HostedServiceProxy, EventSinkAccess
Default implementation of HostedServiceProxy.
-
-
Field Summary
Fields Modifier and Type Field Description public final RequestResponseClientrequestResponseClientpublic final StringactiveEprAddress
-
Method Summary
Modifier and Type Method Description RequestResponseClientgetRequestResponseClient()Gets the request-response client used to send request messages and receive their response. StringgetActiveEprAddress()Gets the physical address that is actively being used to send requests. HostedServiceTypegetType()Gets the hosted service metadata requestable via WS-TransferGet. EventSinkAccessgetEventSinkAccess()Gets the event sink that can be used to subscribe and manage subscriptions of the hosted service. synchronized voidregister(Interceptor interceptor)Registers a callback object. synchronized SoapMessagesendRequestResponse(SoapMessage request)Sends a SOAP request message and waits for the response to be received from the recipient. ListenableFuture<SubscribeResult>subscribe(List<String> actions, @Nullable() Duration expires, Interceptor notificationSink)Subscribes to a set of actions using an action-based filter. ListenableFuture<SubscribeResult>subscribe(String filterDialect, List<Object> filters, @Nullable() Duration expires, Interceptor notificationSink)Generically subscribes to an event source. ListenableFuture<Duration>renew(String subscriptionId, Duration expires)Renews a subscription. ListenableFuture<Duration>getStatus(String subscriptionId)Gets the status of a subscription. ListenableFuture<out Object>unsubscribe(String subscriptionId)Unsubscribes from a subscription. voidunsubscribeAll()Synchronously unsubscribes all subscriptions. -
-
Method Detail
-
getRequestResponseClient
RequestResponseClient getRequestResponseClient()
Gets the request-response client used to send request messages and receive their response.
Hint: the HostingServiceProxy itself implements RequestResponseClient, which is the same as using the return value of this function.
- Returns:
the RequestResponseClient instance capable of requesting this hosted service.
-
getActiveEprAddress
String getActiveEprAddress()
Gets the physical address that is actively being used to send requests.
A hosted service can have different physical addresses in order to be accessible. The one that is returned with this function is the one that was used to initially resolve metadata (GetMetadata request).
- Returns:
the currently active EPR address.
-
getType
HostedServiceType getType()
Gets the hosted service metadata requestable via WS-TransferGet.
- Returns:
a copy of the hosted service metadata received from the network.
-
getEventSinkAccess
EventSinkAccess getEventSinkAccess()
Gets the event sink that can be used to subscribe and manage subscriptions of the hosted service.
Attention: the event sink only works if the underlying hosted service acts as an event source. It is up to the user check the availability in advance, otherwise calls will end up in SOAP faults.
- Returns:
the EventSinkAccess instance.
-
register
synchronized void register(Interceptor interceptor)
Registers a callback object.
- Parameters:
interceptor- an object that possesses MessageInterceptor annotated methods.
-
sendRequestResponse
synchronized SoapMessage sendRequestResponse(SoapMessage request)
Sends a SOAP request message and waits for the response to be received from the recipient.
- Parameters:
request- outgoing request message.- Returns:
incoming response message.
-
subscribe
ListenableFuture<SubscribeResult> subscribe(List<String> actions, @Nullable() Duration expires, Interceptor notificationSink)
Subscribes to a set of actions using an action-based filter. This is a convenience function to subscribe for action-based filters, which is required to be supported by DPWS.
- Parameters:
actions- a list of operation actions to subscribe for.expires- the desired expiration time (the hosted service may decide to grant less than this).notificationSink- the sink where to deliver notifications.- Returns:
a future object that either includes subscription information or throws
-
subscribe
ListenableFuture<SubscribeResult> subscribe(String filterDialect, List<Object> filters, @Nullable() Duration expires, Interceptor notificationSink)
Generically subscribes to an event source. Use subscribe if action-based filtering is used.
- Parameters:
filterDialect- the filter dialect URI.filters- a list of filter objects towards the subscription.expires- the desired expiration time (the hosted service may decide to grant less or more than this).notificationSink- the sink where to deliver notifications.- Returns:
a future object that either includes subscription information or throws
-
renew
ListenableFuture<Duration> renew(String subscriptionId, Duration expires)
Renews a subscription.
- Parameters:
subscriptionId- the subscription id obtained in the SubscribeResult of subscribe.expires- the desired new expiration duration.- Returns:
a future object that either includes a granted expires duration or throws
-
getStatus
ListenableFuture<Duration> getStatus(String subscriptionId)
Gets the status of a subscription.
- Parameters:
subscriptionId- the subscription id obtained in the SubscribeResult of subscribe.- Returns:
a future object that either includes the remaining subscription time or throws
-
unsubscribe
ListenableFuture<out Object> unsubscribe(String subscriptionId)
Unsubscribes from a subscription.
- Parameters:
subscriptionId- the subscription id obtained in the SubscribeResult of subscribe.- Returns:
a future object that either delivers an empty object in case of successful unsubscribe or throws
-
unsubscribeAll
void unsubscribeAll()
Synchronously unsubscribes all subscriptions.
-
-
-
-