it.could.webdav
Class DAVRepository

java.lang.Object
  extended byit.could.webdav.DAVRepository
Direct Known Subclasses:
XMLRepository

public class DAVRepository
extends Object

A simple class representing a File based WebDAV repository.

Author:
Pier Fumagalli

Constructor Summary
DAVRepository(File root)
          Create a new DAVRepository instance.
 
Method Summary
 void addListener(DAVListener listener)
          Add a new DAVListener to the list of instances notified by this DAVRepository.
protected  URI getRepositoryURI()
          Return the URI representing the root directory of this DAVRepository.
 DAVResource getResource(String name)
          Return the DAVResource associated with the given name.
 DAVResource getResource(URI uri)
          Return the DAVResource associated with a URI.
protected  void notify(DAVResource resource, int event)
          Notify all configured DAVListeners of an event.
 void removeListener(DAVListener listener)
          Remove a DAVListener from the list of instances notified by this DAVRepository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAVRepository

public DAVRepository(File root)
              throws IOException

Create a new DAVRepository instance.

Parameters:
root - The File identifying the root of the repository.
Throws:
IOException - If the specified root is not a directory.
NullPointerExceptoin - If the specified root was null.
Method Detail

getRepositoryURI

protected URI getRepositoryURI()

Return the URI representing the root directory of this DAVRepository.

Returns:
a non-null URI instance.

getResource

public DAVResource getResource(String name)
                        throws IOException

Return the DAVResource associated with the given name.

Parameters:
name - a String identifying the resource name.
Returns:
a non-null DAVResource instance.
Throws:
IOException - If the resource could not be resolved.

getResource

public DAVResource getResource(URI uri)
                        throws IOException

Return the DAVResource associated with a URI.

If the specified URI is relative it will be resolved against the root of this DAVRepository.

Parameters:
uri - an absolute or relative URI identifying the resource.
Returns:
a non-null DAVResource instance.
Throws:
IOException - If the resource could not be resolved.

addListener

public void addListener(DAVListener listener)

Add a new DAVListener to the list of instances notified by this DAVRepository.


removeListener

public void removeListener(DAVListener listener)

Remove a DAVListener from the list of instances notified by this DAVRepository.


notify

protected void notify(DAVResource resource,
                      int event)

Notify all configured DAVListeners of an event.