Package org.somda.sdc.dpws.service
Class HostedServiceProxyImpl
java.lang.Object
org.somda.sdc.dpws.service.HostedServiceProxyImpl
- All Implemented Interfaces:
EventSinkAccess,HostedServiceProxy,InterceptorHandler,RequestResponseClient
Default implementation of HostedServiceProxy.
-
Method Summary
Modifier and TypeMethodDescriptionGets the physical address that is actively being used to send requests.Gets the event sink that can be used to subscribe and manage subscriptions of the hosted service.Gets the request-response client used to send request messages and receive their response.com.google.common.util.concurrent.ListenableFuture<Duration>Gets the status of a subscription.org.somda.sdc.dpws.model.HostedServiceTypegetType()Gets the hosted service metadata requestable via WS-TransferGet.voidregister(Interceptor interceptor) Registers a callback object.com.google.common.util.concurrent.ListenableFuture<Duration>Renews a subscription.sendRequestResponse(SoapMessage request) Sends a SOAP request message and waits for the response to be received from the recipient.com.google.common.util.concurrent.ListenableFuture<SubscribeResult>subscribe(String filterDialect, List<Object> filters, Duration expires, Interceptor notificationSink) Generically subscribes to an event source.com.google.common.util.concurrent.ListenableFuture<SubscribeResult>subscribe(List<String> actions, Duration expires, Interceptor notificationSink) Subscribes to a set of actions using an action-based filter.com.google.common.util.concurrent.ListenableFuture<?>unsubscribe(String subscriptionId) Unsubscribes from a subscription.voidSynchronously unsubscribes all subscriptions.
-
Method Details
-
getType
public org.somda.sdc.dpws.model.HostedServiceType getType()Description copied from interface:HostedServiceProxyGets the hosted service metadata requestable via WS-TransferGet.- Specified by:
getTypein interfaceHostedServiceProxy- Returns:
- a copy of the hosted service metadata received from the network.
-
getRequestResponseClient
Description copied from interface:HostedServiceProxyGets 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.- Specified by:
getRequestResponseClientin interfaceHostedServiceProxy- Returns:
- the
RequestResponseClientinstance capable of requesting this hosted service.
-
getEventSinkAccess
Description copied from interface:HostedServiceProxyGets 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.
- Specified by:
getEventSinkAccessin interfaceHostedServiceProxy- Returns:
- the
EventSinkAccessinstance.
-
getActiveEprAddress
Description copied from interface:HostedServiceProxyGets 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).
- Specified by:
getActiveEprAddressin interfaceHostedServiceProxy- Returns:
- the currently active EPR address.
-
register
Description copied from interface:InterceptorHandlerRegisters a callback object.- Specified by:
registerin interfaceInterceptorHandler- Parameters:
interceptor- an object that possessesMessageInterceptorannotated methods.- See Also:
-
sendRequestResponse
public SoapMessage sendRequestResponse(SoapMessage request) throws SoapFaultException, MarshallingException, TransportException, InterceptorException Description copied from interface:RequestResponseClientSends a SOAP request message and waits for the response to be received from the recipient.- Specified by:
sendRequestResponsein interfaceRequestResponseClient- Parameters:
request- outgoing request message.- Returns:
- incoming response message.
- Throws:
SoapFaultException- if a SOAP fault comes up during processing.MarshallingException- if any exception occurs during marshalling or unmarshalling of SOAP messages.TransportException- if transport-related exceptions come up during processing. This will hinder the response from being sent.InterceptorException- if one of the interceptors pops up with an error.
-
subscribe
public com.google.common.util.concurrent.ListenableFuture<SubscribeResult> subscribe(List<String> actions, @Nullable Duration expires, Interceptor notificationSink) Description copied from interface:EventSinkAccessSubscribes 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.- Specified by:
subscribein interfaceEventSinkAccess- 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). If none is given, the hosting service will take decision.notificationSink- the sink where to deliver notifications.- Returns:
- a future object that either includes subscription information or throws
-
subscribe
public com.google.common.util.concurrent.ListenableFuture<SubscribeResult> subscribe(String filterDialect, List<Object> filters, @Nullable Duration expires, Interceptor notificationSink) Description copied from interface:EventSinkAccessGenerically subscribes to an event source. UseEventSinkAccess.subscribe(List, Duration, Interceptor)if action-based filtering is used.- Specified by:
subscribein interfaceEventSinkAccess- 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). If none is given, the hosting service will take decision.notificationSink- the sink where to deliver notifications.- Returns:
- a future object that either includes subscription information or throws
-
renew
public com.google.common.util.concurrent.ListenableFuture<Duration> renew(String subscriptionId, Duration expires) Description copied from interface:EventSinkAccessRenews a subscription.- Specified by:
renewin interfaceEventSinkAccess- Parameters:
subscriptionId- the subscription id obtained in theSubscribeResultofEventSinkAccess.subscribe(List, Duration, Interceptor).expires- the desired new expiration duration.- Returns:
- a future object that either includes a granted expires duration or throws
-
getStatus
public com.google.common.util.concurrent.ListenableFuture<Duration> getStatus(String subscriptionId) Description copied from interface:EventSinkAccessGets the status of a subscription.- Specified by:
getStatusin interfaceEventSinkAccess- Parameters:
subscriptionId- the subscription id obtained in theSubscribeResultofEventSinkAccess.subscribe(List, Duration, Interceptor).- Returns:
- a future object that either includes the remaining subscription time or throws
-
unsubscribe
Description copied from interface:EventSinkAccessUnsubscribes from a subscription.- Specified by:
unsubscribein interfaceEventSinkAccess- Parameters:
subscriptionId- the subscription id obtained in theSubscribeResultofEventSinkAccess.subscribe(List, Duration, Interceptor).- Returns:
- a future object that either delivers an empty object in case of successful unsubscribe or throws
-
unsubscribeAll
public void unsubscribeAll()Description copied from interface:EventSinkAccessSynchronously unsubscribes all subscriptions.- Specified by:
unsubscribeAllin interfaceEventSinkAccess- See Also:
-