org.abstracthorizon.danube.webdav
Interface ResourceAdapter

All Known Implementing Classes:
FileSystemWebDAVResourceAdapter, JavaWebDAVResourceAdapter, SpringResourceWebDAVResourceAdapter

public interface ResourceAdapter

This is resource adapter interface that simplifies access to resource from WebDAV handler

Author:
Daniel Sendula

Method Summary
 Object[] collectionElements(Object resource)
          Returns collection elements for given resource
 void copy(Object source, Object destination, boolean recursive)
          Copies the resource to given destination.
 void delete(Object resource)
          Deletes resource
 boolean exists(Object resource)
          Returns true if resource exists
 Object findParentResource(Object resource)
          Returns parent resource for given resource.
 Object findResource(String path)
           Obtains resource object.
 RequestProperty[] getDefaultRequestProperties(Object resource)
           
 ResponseProperty[] getDefaultResponseProperties(Object resource)
           
 InputStream getInpusStream(Object resource, long from, long length)
          Returns input stream of a resource's range
 InputStream getInputStream(Object resource)
          Returns input stream of a resource
 LockingMechanism getLockingMechanism()
          Returns locking mechanism
 NamespacesProvider getNamespacesProvider()
          Returns namespace privider
 OutputStream getOutputStream(Object resource)
          Returns output stream of a resource.
 OutputStream getOutputStream(Object resource, long from, long length)
          Returns output stream of a resource.
 String getResourceETag(Object resource)
          Returns resource ETag (as specified in RFC-2616)
 String getResourceName(Object resource)
          Returns resource name
 boolean isCollection(Object resource)
          Returns true if resource is a collection
 void makeCollection(Object resource)
          Makes a collection
 void move(Object source, Object destination)
          Noves the resource to given destination
 long resourceCreated(Object resource)
          Returns when resource was created or -1 if unknown
 long resourceLastModified(Object resource)
          Returns when resource was last modified or -1 if unknown
 long resourceLength(Object resource)
          Returns resource's length or -1 if unknown
 

Method Detail

findResource

Object findResource(String path)

Obtains resource object. It is supposed to be resource itself or an proxy as File is.

If this method returns null then rest of the method relying on the resource must be able to deal with it since this class users might not care what the value is.

Parameters:
path - path to the resource
Returns:
resource

findParentResource

Object findParentResource(Object resource)
Returns parent resource for given resource.

Parameters:
resource - existing resource
Returns:
parent resource or null if resource is already root of the hierarchy

resourceLength

long resourceLength(Object resource)
Returns resource's length or -1 if unknown

Parameters:
resource - resource
Returns:
resource's length

resourceLastModified

long resourceLastModified(Object resource)
Returns when resource was last modified or -1 if unknown

Parameters:
resource - resource
Returns:
resource's last modified timestamp

resourceCreated

long resourceCreated(Object resource)
Returns when resource was created or -1 if unknown

Parameters:
resource - resource
Returns:
resource's created timestamp

getResourceName

String getResourceName(Object resource)
Returns resource name

Parameters:
resource - resource name
Returns:
resource name

getResourceETag

String getResourceETag(Object resource)
Returns resource ETag (as specified in RFC-2616)

Parameters:
resource - resource
Returns:
etag

exists

boolean exists(Object resource)
Returns true if resource exists

Parameters:
resource - resource
Returns:
true if resource exists

isCollection

boolean isCollection(Object resource)
Returns true if resource is a collection

Parameters:
resource - resource
Returns:
true if resource is a collection

delete

void delete(Object resource)
            throws IOException
Deletes resource

Parameters:
resource - resource
Throws:
IOException - thrown if there was a problem deleting the resource

makeCollection

void makeCollection(Object resource)
                    throws IOException
Makes a collection

Parameters:
resource - resource that identifies collection
Throws:
IOException - thrown if there was a problem while creating the collection

copy

void copy(Object source,
          Object destination,
          boolean recursive)
          throws IOException
Copies the resource to given destination.

Parameters:
source - source resource
destination - destination resource
recursive - will it perform deep copy or not
Throws:
IOException - thrown if there is a problem with copying.

move

void move(Object source,
          Object destination)
          throws IOException
Noves the resource to given destination

Parameters:
source - source
destination - destination
Throws:
IOException - thrown if moving failed

collectionElements

Object[] collectionElements(Object resource)
Returns collection elements for given resource

Parameters:
resource - resource
Returns:
collection elements or null if there is no elemetns or resource is not a colleciton

getDefaultResponseProperties

ResponseProperty[] getDefaultResponseProperties(Object resource)

getDefaultRequestProperties

RequestProperty[] getDefaultRequestProperties(Object resource)

getInputStream

InputStream getInputStream(Object resource)
                           throws IOException
Returns input stream of a resource

Parameters:
resource - resource
Returns:
input stream or null if not supported
Throws:
IOException - thrown if there is a problem returning the input stream

getInpusStream

InputStream getInpusStream(Object resource,
                           long from,
                           long length)
                           throws IOException
Returns input stream of a resource's range

Parameters:
resource - resource
from - from offset
length - amount of bytes to be trasmitted
Returns:
input stream or null if not supported
Throws:
IOException - thrown if there is a problem returning the input stream

getOutputStream

OutputStream getOutputStream(Object resource)
                             throws IOException
Returns output stream of a resource. It creates new resource or overwrites existing.

Parameters:
resource - resource
Returns:
output stream or null if not supported
Throws:
IOException - thrown if there is a problem creating new resource or replaying existing

getOutputStream

OutputStream getOutputStream(Object resource,
                             long from,
                             long length)
                             throws IOException
Returns output stream of a resource. It creates new resource or overwrites existing. Given range specifies that only part of the resource is going to be supplied.

Parameters:
resource - resource
from - from offset
length - number of bytes to be trasmitted
Returns:
output stream or null if not supported
Throws:
IOException - thrown if there is a problem creating new resource or replaying existing

getNamespacesProvider

NamespacesProvider getNamespacesProvider()
Returns namespace privider

Returns:
namespace provider

getLockingMechanism

LockingMechanism getLockingMechanism()
Returns locking mechanism

Returns:
locking mechanism


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.