Package org.somda.sdc.dpws.service
Class HostedServiceProxyImpl
- java.lang.Object
-
- org.somda.sdc.dpws.service.HostedServiceProxyImpl
-
- All Implemented Interfaces:
EventSinkAccess,HostedServiceProxy,InterceptorHandler,RequestResponseClient
public class HostedServiceProxyImpl extends Object implements HostedServiceProxy, EventSinkAccess
Default implementation of HostedServiceProxy.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetActiveEprAddress()Gets the physical address that is actively being used to send requests.EventSinkAccessgetEventSinkAccess()Gets the event sink that can be used to subscribe and manage subscriptions of the hosted service.RequestResponseClientgetRequestResponseClient()Gets the request-response client used to send request messages and receive their response.com.google.common.util.concurrent.ListenableFuture<Duration>getStatus(String subscriptionId)Gets the status of a subscription.HostedServiceTypegetType()Gets the hosted service metadata requestable via WS-TransferGet.voidregister(Interceptor interceptor)Registers a callback object.com.google.common.util.concurrent.ListenableFuture<Duration>renew(String subscriptionId, Duration expires)Renews a subscription.SoapMessagesendRequestResponse(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(List<String> actions, Duration expires, Interceptor notificationSink)Conducts a subscribe.com.google.common.util.concurrent.ListenableFutureunsubscribe(String subscriptionId)Unsubscribes from a subscription.voidunsubscribeAll()Synchronously unsubscribes all subscriptions.
-
-
-
Method Detail
-
getType
public 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
public RequestResponseClient 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
public EventSinkAccess 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
public String 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
public void register(Interceptor interceptor)
Description copied from interface:InterceptorHandlerRegisters a callback object.- Specified by:
registerin interfaceInterceptorHandler- Parameters:
interceptor- an object that possessesMessageInterceptorannotated methods.- See Also:
MessageInterceptor
-
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:EventSinkAccessConducts a subscribe.- 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 lesser 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
public com.google.common.util.concurrent.ListenableFuture unsubscribe(String subscriptionId)
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:
EventSink.unsubscribeAll()
-
-