Class NotificationListener

java.lang.Object
org.apache.webdav.lib.NotificationListener

public class NotificationListener extends Object
The NotificationListener class encapsulates all methods that are required for dealing with WebDAV notifications. It implements poll and push based notification handling.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final Timer
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    NotificationListener(String host, int port, String repositoryHost, int repositoryPort, org.apache.commons.httpclient.protocol.Protocol protocol, org.apache.commons.httpclient.Credentials credentials, String repositoryDomain, int pollInterval, boolean udp)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    fireEvent(int id, Map information)
     
    void
    fireEvent(Map information, org.apache.commons.httpclient.Credentials credentials)
     
    protected void
    fireEvent(org.apache.webdav.lib.NotificationListener.EventMethod eventMethod, org.apache.commons.httpclient.Credentials credentials)
     
    void
    fireVetoableEvent(Map information, org.apache.commons.httpclient.Credentials credentials)
     
    protected void
    poll(String notifiedSubscribers)
     
    boolean
    subscribe(String method, String uri, int depth, int lifetime, int notificationDelay, Subscriber listener, org.apache.commons.httpclient.Credentials credentials)
    Registers a Subscriber with the remote server.
    boolean
    unsubscribe(String uri, Subscriber listener, org.apache.commons.httpclient.Credentials credentials)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • timer

      protected static final Timer timer
  • Constructor Details

    • NotificationListener

      public NotificationListener(String host, int port, String repositoryHost, int repositoryPort, org.apache.commons.httpclient.protocol.Protocol protocol, org.apache.commons.httpclient.Credentials credentials, String repositoryDomain, int pollInterval, boolean udp)
      Parameters:
      host - The ip-address or hostname on which the udp or http-server is running (e.g. "myhost.mydomain.mytld")
      port - The port where the udp or http-server is listening on (e.g. 4444)
      repositoryHost - The ip-adress or hostname of the WebDAV-repository
      repositoryPort - The port of the WebDAV-repository (e.g. 8080)
      protocol - The protocol that should be used to connect to the WebDAV-repository (http or https)
      credentials - The credentials which are used to connect to the WebDAV-repository
      repositoryDomain - The repository domain (e.g. "/slide")
      pollInterval - The poll interval that will be used if no notifications are revieved via UDP/TCP (in milliseconds)
      udp - If set to true, UDP server will be started, otherwise TCP server (must match the repository notification mode)
  • Method Details

    • subscribe

      public boolean subscribe(String method, String uri, int depth, int lifetime, int notificationDelay, Subscriber listener, org.apache.commons.httpclient.Credentials credentials)
      Registers a Subscriber with the remote server.
      Parameters:
      method - the "notification type", determines for what events do you want do subscribe. one of "Update", "Update/newmember", "Delete", "Move".
      uri - the resource for that you subscribe
      depth - the depth of the collection tree that you want to observe
      lifetime - the duration for that you want to observe (in seconds)
      notificationDelay - the time the server waits before it sends a notify message to the host provided in the constructor (in seconds)
      listener - the Subscriber that is called on incomming notifications
      credentials - credentials for authentication on the server observed
      Returns:
      boolean true if subscription succeeded, false if subscription failed
      See Also:
    • unsubscribe

      public boolean unsubscribe(String uri, Subscriber listener, org.apache.commons.httpclient.Credentials credentials)
    • fireEvent

      public void fireEvent(Map information, org.apache.commons.httpclient.Credentials credentials) throws IOException
      Throws:
      IOException
    • fireVetoableEvent

      public void fireVetoableEvent(Map information, org.apache.commons.httpclient.Credentials credentials) throws IOException
      Throws:
      IOException
    • fireEvent

      protected void fireEvent(org.apache.webdav.lib.NotificationListener.EventMethod eventMethod, org.apache.commons.httpclient.Credentials credentials) throws IOException
      Throws:
      IOException
    • fireEvent

      protected void fireEvent(int id, Map information)
    • poll

      protected void poll(String notifiedSubscribers)