Class EventSourceUtil

java.lang.Object
org.somda.sdc.dpws.soap.wseventing.helper.EventSourceUtil

public class EventSourceUtil extends Object
  • Method Details

    • createSubscriptionManagerEprAndRegisterHttpHandler

      public org.somda.sdc.dpws.soap.wsaddressing.model.EndpointReferenceType createSubscriptionManagerEprAndRegisterHttpHandler(String scheme, String address, Integer port, Interceptor interceptor)
      Creates a new subscription manager EPR based on the given transport information.
      Parameters:
      scheme - the scheme (HTTP/HTTPS) to use.
      address - the local address to use for the setup of the manager.
      port - the local port to use for the setup of the manager.
      interceptor - the interceptor that handles incoming HTTP requests.
      Returns:
      the EPR to be used in SubscribeResponse messages.
    • validateRequestBody

      public <T> T validateRequestBody(RequestResponseObject rrObj, Class<T> expectedType) throws SoapFaultException
      Validates a request message against a specific type and returns.
      Type Parameters:
      T - type information for the expected type
      Parameters:
      rrObj - the request response object to be inspected.
      expectedType - the expected type to check against.
      Returns:
      the instance found in the request response object, cast to the given type.
      Throws:
      SoapFaultException - if validation fails.
    • createInvalidMsg

      public SoapMessage createInvalidMsg(RequestResponseObject rrObj, String reason)
      Creates a SOAP fault message with a reason text.
      Parameters:
      rrObj - the request response object to be used for the fault message.
      reason - the reason text.
      Returns:
      a SOAP message representing a fault message.
    • createForNotifyTo

      public SoapMessage createForNotifyTo(String wsaAction, Object payload, SourceSubscriptionManager subMan)
      Creates a notification message.
      Parameters:
      wsaAction - the action URI used for the notification.
      payload - the payload to send as a JAXBElement or an object that can be marshalled.
      subMan - the subscription manager used for reference parameter retrieval.
      Returns:
      a SOAP message representing the notification.
    • grantExpires

      public Duration grantExpires(@Nullable Duration expires) throws SoapFaultException
      Grants an expiration duration for a subscription.
      Parameters:
      expires - the requested expiration duration.
      Returns:
      the granted expiration, which is at most WsEventingConfig.SOURCE_MAX_EXPIRES.
      Throws:
      SoapFaultException - if the duration is zero or negative.
    • validateSubscriptionEpr

      public SourceSubscriptionManager validateSubscriptionEpr(RequestResponseObject rrObj, Map<String,SourceSubscriptionManager> subscriptions) throws SoapFaultException
      Inspects a request message to contain a valid subscription manager.
      Parameters:
      rrObj - the request response object to inspect.
      subscriptions - available subscriptions.
      Returns:
      returns the subscription manager of a valid subscription identifier in rrObj.
      Throws:
      SoapFaultException - if the subscription is not valid (non-existing, expired, ...).
    • unregisterHttpHandler

      public void unregisterHttpHandler(SourceSubscriptionManager subMan)
      Helper function that unregisters a subscription manager from an HTTP handler.
      Parameters:
      subMan - the subscription manager for which to end HTTP request handling.