Class SubscriptionInfo

  • All Implemented Interfaces:
    ObservationConstants, XmlSerializable

    public class SubscriptionInfo
    extends java.lang.Object
    implements ObservationConstants, XmlSerializable
    SubscriptionInfo class encapsulates the subscription info that forms the request body of a SUBSCRIBE request.
    The following xml layout is defined for the subscription info:
     <!ELEMENT subscriptioninfo ( eventtype, nolocal?, filter? ) >
     <!ELEMENT eventtype ANY >
    
     ANY defines any sequence of elements where at least one defines a valid
     eventtype. Note that a single eventtype must not occur multiple times.
    
     <!ELEMENT nolocal EMPTY >
     <!ELEMENT filter ANY >
    
     ANY: any sequence of elements identifying a filter for event listening but
     at least a single element.
     
    See Also:
    ObservationConstants.XML_SUBSCRIPTIONINFO
    • Constructor Detail

      • SubscriptionInfo

        public SubscriptionInfo​(EventType[] eventTypes,
                                boolean isDeep,
                                long timeout)
        Create a new SubscriptionInfo
        Parameters:
        eventTypes -
        isDeep -
        timeout -
      • SubscriptionInfo

        public SubscriptionInfo​(EventType[] eventTypes,
                                Filter[] filters,
                                boolean noLocal,
                                boolean isDeep,
                                long timeout)
        Create a new SubscriptionInfo
        Parameters:
        eventTypes -
        filters -
        noLocal -
        isDeep -
        timeout -
      • SubscriptionInfo

        public SubscriptionInfo​(org.w3c.dom.Element reqInfo,
                                long timeout,
                                boolean isDeep)
                         throws DavException
        Create a new SubscriptionInfo from the given Xml element and from additional information that is transported within the request header:
        Parameters:
        reqInfo - Xml element present in the request body.
        timeout - as defined in the timeout header.
        isDeep - as defined in the depth header.
        Throws:
        java.lang.IllegalArgumentException - if the reqInfo element does not contain the mandatory elements.
        DavException
    • Method Detail

      • getEventTypes

        public EventType[] getEventTypes()
        Return array of event type names present in the subscription info.
        Returns:
        array of String defining the names of the events this subscription should listen to.
      • getFilters

        public Filter[] getFilters()
        Return all filters defined for this SubscriptionInfo
        Returns:
        all filters or an empty Filter array.
      • getFilters

        public Filter[] getFilters​(java.lang.String localName,
                                   Namespace namespace)
        Return array of filters with the specified name.
        Parameters:
        localName - the filter elements must provide.
        namespace -
        Returns:
        array containing the text of the filter elements with the given name.
      • isDeep

        public boolean isDeep()
        Returns true if the depths header defined a depth other than '0'.
        Returns:
        true if this subscription info was created with isDeep true.
      • getTimeOut

        public long getTimeOut()
        Return the timeout as retrieved from the request.
        Returns:
        timeout.
      • toXml

        public org.w3c.dom.Element toXml​(org.w3c.dom.Document document)
        Xml representation of this SubscriptionInfo.
        Specified by:
        toXml in interface XmlSerializable
        Parameters:
        document -
        Returns:
        Xml representation
        See Also:
        XmlSerializable.toXml(Document)