org.apache.cocoon.components.source.impl
Class WebDAVSource

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.source.impl.WebDAVSource
All Implemented Interfaces:
LogEnabled, InspectableSource, ModifiableSource, ModifiableTraversableSource, MoveableSource, Source, TraversableSource

public class WebDAVSource
extends AbstractLogEnabled
implements Source, TraversableSource, ModifiableSource, ModifiableTraversableSource, InspectableSource, MoveableSource

A source implementation to get access to WebDAV repositories.

Protocol syntax

webdav://[user[:password]@]host[:port][/path][?cocoon:webdav-depth][&cocoon:webdav-action]

Version:
$Id: WebDAVSource.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Method Summary
 boolean canCancel(OutputStream stream)
          Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?
 void cancel(OutputStream stream)
          Cancel the data sent to an OutputStream returned by getOutputStream().
 void copyTo(Source source)
          Copy the current source to a specified destination.
 void delete()
          Delete this source (unimplemented).
 boolean exists()
          Does this source actually exist ?
 Source getChild(String childName)
          Get a collection child.
 Collection getChildren()
          Get the collection children.
 long getContentLength()
          Return the content length of the content or -1 if the length is unknown
 InputStream getInputStream()
          Return an InputStream object to read from the source.
 long getLastModified()
          Get the last modification date.
 String getMimeType()
          The mime-type of the content described by this object.
 String getName()
          Get the name of this resource.
 OutputStream getOutputStream()
          Get an OutputStream where raw bytes can be written to.
 Source getParent()
          Get the parent.
 String getScheme()
          Get the scheme for this Source.
protected  String getSecureURI()
          Return the URI securely, without username and password
 SourceProperty[] getSourceProperties()
          Returns a enumeration of the properties
 SourceProperty getSourceProperty(String namespace, String name)
          Returns a property from a source.
 String getURI()
          Return the unique identifer for this source
 SourceValidity getValidity()
          Get the Validity object.
 boolean isCollection()
          Check if this source is a collection.
 void makeCollection()
          Create the collection, if it doesn't exist.
 void moveTo(Source source)
          Move the current source to a specified destination.
static WebDAVSource newWebDAVSource(org.apache.commons.httpclient.HttpURL url, String protocol, Logger logger, WebDAVEventFactory eventfactory)
          Static factory method to obtain a Source.
 void refresh()
          Refresh the content of this object after the underlying data content has changed.
 void removeSourceProperty(String namespace, String name)
          Remove a specified source property.
 void setSourceProperty(SourceProperty sourceproperty)
          Sets a property for a source.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newWebDAVSource

public static WebDAVSource newWebDAVSource(org.apache.commons.httpclient.HttpURL url,
                                           String protocol,
                                           Logger logger,
                                           WebDAVEventFactory eventfactory)
                                    throws org.apache.commons.httpclient.URIException
Static factory method to obtain a Source.

Throws:
org.apache.commons.httpclient.URIException

getScheme

public String getScheme()
Get the scheme for this Source.

Specified by:
getScheme in interface Source

getURI

public String getURI()
Return the unique identifer for this source

Specified by:
getURI in interface Source

getSecureURI

protected String getSecureURI()
Return the URI securely, without username and password


getValidity

public SourceValidity getValidity()
Get the Validity object. This can either wrap the last modification date or the expires information or... If it is currently not possible to calculate such an information null is returned.

Specified by:
getValidity in interface Source

refresh

public void refresh()
Refresh the content of this object after the underlying data content has changed.

Specified by:
refresh in interface Source

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  SourceException
Return an InputStream object to read from the source. This is the data at the point of invocation of this method, so if this is Modifiable, you might get different content from two different invocations.

Specified by:
getInputStream in interface Source
Throws:
IOException
SourceException

getMimeType

public String getMimeType()
The mime-type of the content described by this object. If the source is not able to determine the mime-type by itself this can be null.

Specified by:
getMimeType in interface Source

getContentLength

public long getContentLength()
Return the content length of the content or -1 if the length is unknown

Specified by:
getContentLength in interface Source

getLastModified

public long getLastModified()
Get the last modification date.

Specified by:
getLastModified in interface Source
Returns:
The last modification in milliseconds since January 1, 1970 GMT or 0 if it is unknown

exists

public boolean exists()
Does this source actually exist ?

Specified by:
exists in interface Source
Returns:
true if the resource exists.

getChild

public Source getChild(String childName)
                throws SourceException
Get a collection child.

Specified by:
getChild in interface TraversableSource
Throws:
SourceException
See Also:
TraversableSource.getChild(java.lang.String)

getChildren

public Collection getChildren()
                       throws SourceException
Get the collection children.

Specified by:
getChildren in interface TraversableSource
Throws:
SourceException
See Also:
TraversableSource.getChildren()

getName

public String getName()
Get the name of this resource.

Specified by:
getName in interface TraversableSource
See Also:
TraversableSource.getName()

getParent

public Source getParent()
                 throws SourceException
Get the parent.

Specified by:
getParent in interface TraversableSource
Throws:
SourceException
See Also:
TraversableSource.getParent()

isCollection

public boolean isCollection()
Check if this source is a collection.

Specified by:
isCollection in interface TraversableSource
See Also:
TraversableSource.isCollection()

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Get an OutputStream where raw bytes can be written to. The signification of these bytes is implementation-dependent and is not restricted to a serialized XML document.

Specified by:
getOutputStream in interface ModifiableSource
Returns:
a stream to write to
Throws:
IOException

canCancel

public boolean canCancel(OutputStream stream)
Can the data sent to an OutputStream returned by getOutputStream() be cancelled ?

Specified by:
canCancel in interface ModifiableSource
Returns:
true if the stream can be cancelled

cancel

public void cancel(OutputStream stream)
            throws SourceException
Cancel the data sent to an OutputStream returned by getOutputStream().

After cancel, the stream should no more be used.

Specified by:
cancel in interface ModifiableSource
Throws:
SourceException

delete

public void delete()
            throws SourceException
Delete this source (unimplemented).

Specified by:
delete in interface ModifiableSource
Throws:
SourceException
See Also:
ModifiableSource.delete()

makeCollection

public void makeCollection()
                    throws SourceException
Create the collection, if it doesn't exist.

Specified by:
makeCollection in interface ModifiableTraversableSource
Throws:
SourceException
See Also:
ModifiableTraversableSource.makeCollection()

getSourceProperties

public SourceProperty[] getSourceProperties()
                                     throws SourceException
Returns a enumeration of the properties

Specified by:
getSourceProperties in interface InspectableSource
Returns:
Enumeration of SourceProperty
Throws:
SourceException - If an exception occurs.

getSourceProperty

public SourceProperty getSourceProperty(String namespace,
                                        String name)
                                 throws SourceException
Returns a property from a source.

Specified by:
getSourceProperty in interface InspectableSource
Parameters:
namespace - Namespace of the property
name - Name of the property
Returns:
Property of the source.
Throws:
SourceException - If an exception occurs.

removeSourceProperty

public void removeSourceProperty(String namespace,
                                 String name)
                          throws SourceException
Remove a specified source property.

Specified by:
removeSourceProperty in interface InspectableSource
Parameters:
namespace - Namespace of the property.
name - Name of the property.
Throws:
SourceException - If an exception occurs.

setSourceProperty

public void setSourceProperty(SourceProperty sourceproperty)
                       throws SourceException
Sets a property for a source.

Specified by:
setSourceProperty in interface InspectableSource
Parameters:
sourceproperty - Property of the source
Throws:
SourceException - If an exception occurs during this operation

moveTo

public void moveTo(Source source)
            throws SourceException
Move the current source to a specified destination.

Specified by:
moveTo in interface MoveableSource
Parameters:
source -
Throws:
SourceException - If an exception occurs during the move.

copyTo

public void copyTo(Source source)
            throws SourceException
Copy the current source to a specified destination.

Specified by:
copyTo in interface MoveableSource
Parameters:
source -
Throws:
SourceException - If an exception occurs during the copy.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.