org.w3c.jigsaw.webdav
Class DAVFrame

java.lang.Object
  extended by org.w3c.tools.resources.AttributeHolder
      extended by org.w3c.tools.resources.Resource
          extended by org.w3c.tools.resources.FramedResource
              extended by org.w3c.tools.resources.ResourceFrame
                  extended by org.w3c.tools.resources.ProtocolFrame
                      extended by org.w3c.jigsaw.frames.HTTPFrame
                          extended by org.w3c.jigsaw.frames.PostableFrame
                              extended by org.w3c.jigsaw.webdav.DAVFrame
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, AttributeChangedListener, FrameEventListener
Direct Known Subclasses:
CvsDAVDirectoryFrame, CvsDAVFileFrame

public class DAVFrame
extends PostableFrame


Field Summary
protected static int ATTR_CREATION_DATE
          Attribute index - The index for the creation date attribute.
protected static int ATTR_DEAD_PROPERTIES
          Attribute index - The index for the dead properties
protected static int ATTR_LOCK_DATE
          Attribute index - The index for the lock date
protected static int ATTR_LOCK_DEPTH
          Attribute index - The index for the lock depth
protected static int ATTR_LOCK_OWNER
          Attribute index - The index for the lock owner
protected static int ATTR_LOCK_TIMEOUT
          Attribute index - The index for the lock token
protected static int ATTR_LOCK_TOKEN
          Attribute index - The index for the lock token
protected static int ATTR_LOCK_USERNAME
          Attribute index - The index for the lock username
protected static HttpMimeType collectioncontenttype
           
static int COND_OK_LOCK
          Condition check return code - Condition existed and succeeded.
protected  java.util.Hashtable deadindex
           
protected  boolean deadpropmodified
           
static boolean debug
           
static boolean debugxml
           
static java.lang.Long DEFAULT_LOCK_TIMEOUT
           
static java.lang.String LOCK_EXPIRE
           
static java.lang.String LOCK_OWNER
           
static java.lang.String LOCK_TIMEOUT
           
static java.lang.String LOCK_TOKEN
           
static java.lang.String LOCK_USERNAME
           
static java.lang.String LOCKED_REREFENCE
           
protected  DAVManager manager
          The DAVManager we use.
static java.lang.Long MAX_LOCK_TIMEOUT
           
protected  org.w3c.dom.Node ownerNode
           
static java.lang.String REMAINING_PATH
          Name ot the state to hold the remaining path (used with MKCOL)
protected static HttpMimeType xmlcontenttype
          Cached mime type
 
Fields inherited from class org.w3c.jigsaw.frames.PostableFrame
ATTR_CONVERT_GET, ATTR_OVERIDE
 
Fields inherited from class org.w3c.jigsaw.frames.HTTPFrame
acceptRanges, allowed, ATTR_ALLOW_DEL, ATTR_BROWSABLE, ATTR_CHARSET, ATTR_CONTENT_ENCODING, ATTR_CONTENT_LANGUAGE, ATTR_CONTENT_LENGTH, ATTR_CONTENT_TYPE, ATTR_ICON, ATTR_ICONDIR, ATTR_INDEX, ATTR_INDEXES, ATTR_MAXAGE, ATTR_MD5, ATTR_PUTABLE, ATTR_QUALITY, ATTR_RELOCATE, ATTR_STYLE_LINK, ATTR_TITLE, browsetype, COND_FAILED, COND_OK, COND_WEAK, dresource, fresource, listing, listing_stamp, STATE_CONTENT_LOCATION
 
Fields inherited from class org.w3c.tools.resources.ResourceFrame
filterClass, frameListener, resource
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, values
 
Constructor Summary
DAVFrame()
           
 
Method Summary
protected static boolean acceptRedirect(DAVRequest request)
           
protected  void addContentLanguage(DAVProperties props)
           
protected  void addContentLength(DAVProperties props)
           
protected  void addContentType(DAVProperties props)
           
protected  void addCreationDate(DAVProperties props)
           
protected  void addDisplayName(DAVProperties props)
           
protected  void addETag(DAVProperties props)
           
protected  void addIsCollection(DAVProperties props)
           
protected  void addLastModified(DAVProperties props)
           
protected  void addLockDiscovery(DAVRequest request, DAVProperties prop)
           
protected  void addLockDiscovery(DAVRequest request, org.w3c.dom.Node parent)
           
protected  void addResourceType(DAVProperties props)
           
protected  void addSupportedLock(DAVProperties prop)
           
protected  int checkIf(DAVRequest request)
          Check the If condition of that request.
protected  boolean checkLockOwner(DAVRequest request)
           
protected  void closeInternalReply(DAVReply reply)
           
protected  java.net.URL computeDestURL(java.net.URL parent, DAVFrame df)
           
 Reply copy(DAVRequest request)
          Handle the COPY request.
protected  Reply copyCollection(java.net.URL destination, DAVRequest request, boolean overwrite)
          Handle the COPY request for a collection
protected  Reply copyCollection(java.net.URL destination, DAVRequest request, boolean overwrite, DAVBody body, org.w3c.dom.Document document)
           
protected  DAVReply copyDAVResource(DAVRequest req, java.net.URL source, java.net.URL destination, DAVBody body)
           
protected  void copyProperties(DAVRequest req, java.net.URL destination, DAVBody body)
           
protected  Reply copyResource(java.net.URL dst, DAVRequest request, boolean overwrite)
          Handle the COPY request for a simple resource (not a collection)
protected  Reply createDAVReply(DAVRequest request, int status, org.w3c.dom.Document document)
          Create a DAV reply for a specific DAV request.
protected  DAVRequest createInternalRequest(DAVRequest req, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers)
           
protected  DAVRequest createInternalRequest(DAVRequest request, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, org.w3c.dom.Document document)
           
protected  DAVRequest createInternalRequest(DAVRequest req, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, java.io.InputStream in)
           
protected  DAVRequest createRequest(DAVRequest request, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers)
           
protected  DAVRequest createRequest(DAVRequest request, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, org.w3c.dom.Document document)
           
protected  DAVRequest createRequest(DAVRequest req, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, java.io.InputStream in)
           
 Reply davextended(DAVRequest request)
           
protected  java.lang.String decodeURL(DAVRequest request, java.lang.String encoded)
           
 Reply delete(Request request)
          The WEBDAV DELETE method, actually the resource (file, directory) is moved into the trash directory which is not accessible via HTTP.
protected  Reply dupReply(DAVRequest request, DAVReply rep, boolean created)
          Kind of proxying the reply but only for headers.
 Reply extended(Request request)
          The handler for unknown method replies with a not implemented.
 Reply get(Request request)
          Get this resource body.
protected  HttpTokenList getAllow()
          get the Allowed methods for this resource
protected  DAVBody getBody(DAVRequest request)
           
protected  DAVResponse[] getChildResponses(DAVRequest request, DAVPropFind dpf, org.w3c.dom.Document document, boolean deep)
          Get an appropriate DAV Response to the given PROPFIND request from our children
 long getCreationDate()
          Get this resource creation date
protected  int getCurrentLockDepth()
          Get the lock depth
protected  org.w3c.dom.Node getCurrentLockOwner(DAVRequest request)
          Get the lock owner
protected  long getCurrentLockTimeout(DAVRequest request)
           
protected  java.lang.String getCurrentLockToken(DAVRequest request)
          Get the lock token
protected  java.lang.String getCurrentLockUsername(DAVRequest request)
          Get the username of the client that lock the resource
 ArrayDictionary getDeadProperties()
          Get the dead properties
protected  java.util.Hashtable getDeadPropertiesIndex()
           
protected  java.lang.String getNewLockToken()
           
protected  DAVProperties getProperties(DAVRequest request, org.w3c.dom.Document doc)
          Get all the properties of our associated resource.
protected  DAVProperties getProperties(DAVRequest request, org.w3c.dom.Document doc, DAVProperties dp)
          Get the properties of our associated resource require in the given DAVProperties Object.
protected  DAVProperties getPropertiesForCopy(org.w3c.dom.Document doc)
           
protected  DAVProperties getPropNames(DAVRequest request, org.w3c.dom.Document doc)
          Get all the property names of our associated resource.
protected  DAVPropStat[] getPropStat(DAVRequest request, org.w3c.dom.Document doc, DAVProperties dp)
           
protected  DAVResponse getResponse(DAVRequest request, DAVPropFind dpf, org.w3c.dom.Document document)
          Get an appropriate DAV Response to the given PROPFIND request
protected  java.lang.String getStatusLine(int status)
           
protected  long getTokenExpirationDate(DAVRequest request)
          Get the lock token expiration date
protected  boolean hasIntProperty(int idx)
           
protected  boolean hasLongProperty(int idx)
           
protected  boolean hasProperty(int idx)
           
protected  boolean hasStringProperty(int idx)
           
 void initialize(java.lang.Object[] values)
          Initialize the frames of that framed resource.
protected  Reply internalCopyCollection(java.net.URL destination, DAVRequest request, boolean overwrite, DAVBody body, org.w3c.dom.Document document)
           
protected  DAVReply internalCopyDAVResource(DAVRequest req, java.net.URL source, java.net.URL destination, DAVBody body)
           
protected  void internalCopyProperties(DAVRequest req, java.net.URL destination, DAVBody body)
           
protected  Reply internalCopyResource(java.net.URL dst, DAVRequest request, boolean overwrite)
          Handle the COPY request for a simple resource (not a collection)
 boolean isCollection()
           
protected  boolean isLockable(DAVRequest request)
           
protected  boolean isLocked(DAVRequest request)
          Check if this resource or one of their parent (with depth equals to infinity) has been locked
protected static boolean isReadOnly(java.lang.String propname)
           
 Reply lock(DAVRequest request)
          Handle the LOCK request.
protected  void lock(java.lang.String token, int depth, java.lang.String[] timeouts, java.lang.String username, org.w3c.dom.Node owner)
          lock this resource
protected  boolean lookupDirectory(LookupState ls, LookupResult lr)
          Lookup the target resource when associated with a DirectoryResource.
protected  boolean lookupResource(LookupState ls, LookupResult lr)
          Lookup the target resource (dispath to more specific lookup methods).
protected  boolean matchETag(HttpEntityTag retag)
           
protected  boolean matchLockToken(DAVRequest request, java.lang.String locktoken)
           
 Reply mkcol(DAVRequest request)
          Handle the MKCOL request.
 Reply move(DAVRequest request)
          Handle the MOVE request.
 Reply options(Request request)
          The WEBDAV OPTIONS method replies with the DAV Header
 ReplyInterface perform(RequestInterface req)
          Perform the request
 Reply post(Request request)
          Perform the post method.
 Reply propfind(DAVRequest request)
          Handle the PROPFIND request.
 Reply proppatch(DAVRequest request)
          Handle the PROPPATCH request.
 Reply put(Request request)
          The WEBDAV PUT method.
protected  void refreshLock(java.lang.String[] timeouts)
           
 void registerResource(FramedResource resource)
          companion to initialize, called after the register
protected  void reloadDeadProperties()
           
protected  DAVPropStat removeDAVProperties(DAVProperties props, org.w3c.dom.Document document)
           
protected  void removeDeadProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void removeDeadProperty(org.w3c.dom.Element el)
           
protected  void removeLiveProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void saveDeadProperties()
           
protected  DAVPropStat setDAVProperties(DAVProperties props, org.w3c.dom.Document document)
           
protected  void setDeadProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void setDeadProperty(org.w3c.dom.Element el)
           
protected  void setLiveProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void setLockOwner(org.w3c.dom.Node owner)
          Set the lock Owner
protected  void setTimeout(java.lang.String[] timeouts)
           
protected  void skipBody(DAVReply reply)
          Should be called to purge the reply, otherwise the connection won't be marked idle and won't be reused.
protected  void unlock()
           
 Reply unlock(DAVRequest request)
          Handle the UNLOCK request.
protected  void updateLockDate(DAVRequest request)
           
 
Methods inherited from class org.w3c.jigsaw.frames.PostableFrame
getConvertGetFlag, getOverrideFlag, handle
 
Methods inherited from class org.w3c.jigsaw.frames.HTTPFrame
addStyleSheet, attributeChanged, browse, checkExpect, checkIfMatch, checkIfModifiedSince, checkIfNoneMatch, checkIfUnmodifiedSince, checkRequest, checkValidators, computeContainerListing, computeETag, computeTrashDir, computeTrashFile, createDefaultReply, createFileReply, deleteDirectoryResource, deleteFileResource, deleteMe, deleteOtherResource, getAllowDeleteFlag, getBrowsableFlag, getBrowseType, getCharset, getContentEncoding, getContentLanguage, getContentLength, getContentType, getDirectoryListing, getDirectoryResource, getDirectoryResource, getETag, getFileResource, getFileResource, getHelpURL, getHelpURL, getIcon, getIconDirectory, getIndex, getIndexes, getMaxAge, getMD5Flag, getOtherResource, getPutableFlag, getQuality, getRelocateFlag, getStyleSheetURL, getTitle, getURL, handleRangeRequest, head, headDirectoryResource, headFileResource, headOtherResource, initialize, link, lookup, lookupFile, lookupOther, performFrames, pickleValues, putFileResource, putOtherResource, registerOtherResource, setValue, trace, unlink, unsafeGetQuality, updateCachedHeaders
 
Methods inherited from class org.w3c.tools.resources.ResourceFrame
addFrameEventListener, eventDisabled, fireFrameEvent, frameModified, getFilters, getFilters, getFrameReference, getResource, getResourceReference, getSpaceEntry, getURLPath, lookupFilters, lookupFrames, postFrameEvent, processEvent, removeFrameEventListener, unregisterResource, updateDefaultChildAttributes
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, markModified, notifyUnload, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, isInitialized, isUnloaded, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

debugxml

public static final boolean debugxml
See Also:
Constant Field Values

COND_OK_LOCK

public static final int COND_OK_LOCK
Condition check return code - Condition existed and succeeded. And lock has been checked

See Also:
Constant Field Values

xmlcontenttype

protected static HttpMimeType xmlcontenttype
Cached mime type


collectioncontenttype

protected static HttpMimeType collectioncontenttype

manager

protected DAVManager manager
The DAVManager we use.


REMAINING_PATH

public static final java.lang.String REMAINING_PATH
Name ot the state to hold the remaining path (used with MKCOL)

See Also:
Constant Field Values

LOCK_USERNAME

public static final java.lang.String LOCK_USERNAME
See Also:
Constant Field Values

LOCK_TOKEN

public static final java.lang.String LOCK_TOKEN
See Also:
Constant Field Values

LOCK_OWNER

public static final java.lang.String LOCK_OWNER
See Also:
Constant Field Values

LOCK_EXPIRE

public static final java.lang.String LOCK_EXPIRE
See Also:
Constant Field Values

LOCK_TIMEOUT

public static final java.lang.String LOCK_TIMEOUT
See Also:
Constant Field Values

LOCKED_REREFENCE

public static final java.lang.String LOCKED_REREFENCE
See Also:
Constant Field Values

DEFAULT_LOCK_TIMEOUT

public static final java.lang.Long DEFAULT_LOCK_TIMEOUT

MAX_LOCK_TIMEOUT

public static final java.lang.Long MAX_LOCK_TIMEOUT

ATTR_CREATION_DATE

protected static int ATTR_CREATION_DATE
Attribute index - The index for the creation date attribute.


ATTR_DEAD_PROPERTIES

protected static int ATTR_DEAD_PROPERTIES
Attribute index - The index for the dead properties


ATTR_LOCK_TOKEN

protected static int ATTR_LOCK_TOKEN
Attribute index - The index for the lock token


ATTR_LOCK_TIMEOUT

protected static int ATTR_LOCK_TIMEOUT
Attribute index - The index for the lock token


ATTR_LOCK_DATE

protected static int ATTR_LOCK_DATE
Attribute index - The index for the lock date


ATTR_LOCK_DEPTH

protected static int ATTR_LOCK_DEPTH
Attribute index - The index for the lock depth


ATTR_LOCK_OWNER

protected static int ATTR_LOCK_OWNER
Attribute index - The index for the lock owner


ATTR_LOCK_USERNAME

protected static int ATTR_LOCK_USERNAME
Attribute index - The index for the lock username


ownerNode

protected org.w3c.dom.Node ownerNode

deadindex

protected java.util.Hashtable deadindex

deadpropmodified

protected boolean deadpropmodified
Constructor Detail

DAVFrame

public DAVFrame()
Method Detail

isReadOnly

protected static boolean isReadOnly(java.lang.String propname)

acceptRedirect

protected static boolean acceptRedirect(DAVRequest request)

isCollection

public boolean isCollection()

getCreationDate

public long getCreationDate()
Get this resource creation date

Returns:
A long giving the creation date or -1 if undefined.

updateLockDate

protected void updateLockDate(DAVRequest request)

getTokenExpirationDate

protected long getTokenExpirationDate(DAVRequest request)
Get the lock token expiration date

Returns:
A long giving the expiration date or -1 if undefined.

getCurrentLockToken

protected java.lang.String getCurrentLockToken(DAVRequest request)
Get the lock token

Returns:
A String instance or null

getCurrentLockTimeout

protected long getCurrentLockTimeout(DAVRequest request)

getCurrentLockOwner

protected org.w3c.dom.Node getCurrentLockOwner(DAVRequest request)
Get the lock owner

Returns:
A String instance or null

setLockOwner

protected void setLockOwner(org.w3c.dom.Node owner)
Set the lock Owner


getCurrentLockDepth

protected int getCurrentLockDepth()
Get the lock depth

Returns:
An int (WEBDAV.DEPTH_0 or WEBDAV.DEPTH_INFINITY)

getCurrentLockUsername

protected java.lang.String getCurrentLockUsername(DAVRequest request)
Get the username of the client that lock the resource


isLocked

protected boolean isLocked(DAVRequest request)
Check if this resource or one of their parent (with depth equals to infinity) has been locked

Parameters:
request - the incomming request (it null isLocked will returns true if and only if the resource has been personally locked, not one of its parents)
Returns:
a boolean

setTimeout

protected void setTimeout(java.lang.String[] timeouts)

refreshLock

protected void refreshLock(java.lang.String[] timeouts)

lock

protected void lock(java.lang.String token,
                    int depth,
                    java.lang.String[] timeouts,
                    java.lang.String username,
                    org.w3c.dom.Node owner)
             throws HTTPException
lock this resource

Parameters:
token - the lock token
depth - the lock depth (0 or -1)
timeout - the lock timeout
Throws:
HTTPException

unlock

protected void unlock()

addSupportedLock

protected void addSupportedLock(DAVProperties prop)

addLockDiscovery

protected void addLockDiscovery(DAVRequest request,
                                DAVProperties prop)

addLockDiscovery

protected void addLockDiscovery(DAVRequest request,
                                org.w3c.dom.Node parent)

getDeadProperties

public ArrayDictionary getDeadProperties()
Get the dead properties

Returns:
a ArrayDictionary instance
See Also:
ArrayDictionary

getDeadPropertiesIndex

protected java.util.Hashtable getDeadPropertiesIndex()

setDeadProperty

protected void setDeadProperty(org.w3c.dom.Element el)
                        throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

removeDeadProperty

protected void removeDeadProperty(org.w3c.dom.Element el)
                           throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

reloadDeadProperties

protected void reloadDeadProperties()

saveDeadProperties

protected void saveDeadProperties()

getAllow

protected HttpTokenList getAllow()
get the Allowed methods for this resource

Overrides:
getAllow in class PostableFrame
Returns:
an HttpTokenList

getBody

protected DAVBody getBody(DAVRequest request)
                   throws HTTPException
Throws:
HTTPException

options

public Reply options(Request request)
              throws ProtocolException,
                     ResourceException
The WEBDAV OPTIONS method replies with the DAV Header

Overrides:
options in class HTTPFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - In case of errors.
ResourceException - If the resource got a fatal error.

perform

public ReplyInterface perform(RequestInterface req)
                       throws ProtocolException,
                              ResourceException
Perform the request

Overrides:
perform in class HTTPFrame
Parameters:
req - The request to handle.
Returns:
a ReplyInterface instance
Throws:
ProtocolException - If processsing the request failed.