com.ithit.webdav.server
Interface HierarchyItem

All Known Subinterfaces:
DeltaVItem, File, Folder, History, Version, VersionableItem

public interface HierarchyItem

Represents file or folder in the WebDAV repository.

Defines methods common to all WebDAV folders and files. getCreated() and getModified() methods must return Universal Coordinated Time (UTC). getProperties(com.ithit.webdav.server.Property[]) and updateProperties(com.ithit.webdav.server.Property[], com.ithit.webdav.server.Property[]) are called when WebDAV client is reading, adding, updating or deleting custom properties. This interface also provides methods for managing hierarchy: moving, copying and deleting WebDAV items. See copyTo(com.ithit.webdav.server.Folder, java.lang.String, boolean), moveTo(com.ithit.webdav.server.Folder, java.lang.String) and delete() methods. Your file items must implement File interface, folder items - Folder interface.


Method Summary
 void copyTo(Folder folder, java.lang.String destName, boolean deep)
          Creates a copy of this item with a new name in the destination folder.
 void delete()
          Deletes this item.
 long getCreated()
          Gets the creation date of the item in repository expressed as the coordinated universal time (UTC).
 long getModified()
          Gets the last modification date of the item in repository expressed as the coordinated universal time (UTC).
 java.lang.String getName()
          Gets the name of the item in repository.
 java.lang.String getPath()
          Unique item path in the repository relative to storage root.
 java.util.List<Property> getProperties(Property[] props)
          Gets values of all properties or selected properties for this item.
 java.util.List<Property> getPropertyNames()
          Gets names of all properties for this item.
 void moveTo(Folder folder, java.lang.String destName)
          Moves this item to the destination folder under a new name.
 void updateProperties(Property[] setProps, Property[] delProps)
          Modifies and removes properties for this item.
 

Method Detail

getName

java.lang.String getName()
                         throws ServerException
Gets the name of the item in repository.

Returns:
Name of this item.
Throws:
ServerException - In case of an error.

getCreated

long getCreated()
                throws ServerException
Gets the creation date of the item in repository expressed as the coordinated universal time (UTC).

Returns:
Creation date of the item.
Throws:
ServerException - In case of an error.

getModified

long getModified()
                 throws ServerException
Gets the last modification date of the item in repository expressed as the coordinated universal time (UTC).

Returns:
Modification date of the item.
Throws:
ServerException - In case of an error.

getPath

java.lang.String getPath()
                         throws ServerException
Unique item path in the repository relative to storage root.

The URL returned by this method is relative to storage root. If your server root is located at ‘http://webdavserver.com/myserver/’ and the item URL is ‘http://webdavserver.com/myserver/myfolder/myitem.doc’ this property implementation must return ‘myfolder/myitem.doc’. To calculate the entire item URL the engine will call HttpServletRequest.getContextPath() property and attach it to url returned by this property.

Examples:

Returns:
Item path relative to storage root.
Throws:
ServerException - In case of an error.

getProperties

java.util.List<Property> getProperties(Property[] props)
                                       throws ServerException
Gets values of all properties or selected properties for this item.

Parameters:
props -
  • Array of properties which values are requested.
  • null to get all properties.
Returns:
List of properties with values set. If property cannot be found it shall be omitted from the result.
Throws:
ServerException - In case of an error.

getPropertyNames

java.util.List<Property> getPropertyNames()
                                          throws ServerException
Gets names of all properties for this item.

Most WebDAV clients never request list of property names, so your implementation can just throw ServerException with WebDavStatus.NOT_ALLOWED status.

Returns:
List of all property names for this item.
Throws:
ServerException - In case of an error.

updateProperties

void updateProperties(Property[] setProps,
                      Property[] delProps)
                      throws LockedException,
                             MultistatusException,
                             ServerException
Modifies and removes properties for this item.

Parameters:
setProps - Array of properties to be set.
delProps - Array of properties to be removed. Property.value field is ignored. Specifying the removal of a property that does not exist is not an error.
Throws:
LockedException - this item was locked and client did not provide lock token.
MultistatusException - If update fails for a property, this exception shall be thrown and contain result of the operation for each property. Status for each property can be one of following:
  • WebDavStatus.OK - the property was successfully updated or deleted.
  • WebDavStatus.CONFLICT - the client has provided a value whose semantics are not appropriate for the property, this includes trying to set read-only properties.
  • WebDavStatus.FAILED_DEPENDENCY - indicates this action would have succeeded if it were not for the conflict with updating/removing some other property.
ServerException - In case of other error.

copyTo

void copyTo(Folder folder,
            java.lang.String destName,
            boolean deep)
            throws LockedException,
                   ConflictException,
                   MultistatusException,
                   ServerException
Creates a copy of this item with a new name in the destination folder.

If error occurred while copying items located in a subtree, the server should try to continue copy operation and copy all other items. In this case you must throw MultistatusException that contain separate response for every item that was successfully copied or failed to copy.

A CopyTo method invocation must not copy any locks active on the source item. However, if this method copies the item into a folder that has a deep lock, then the destination item must be added to the lock.

Parameters:
folder - Destination folder.
destName - Name of the destination item.
deep - Indicates whether to copy entire subtree.
Throws:
LockedException - - the destination item was locked and client did not provide lock token.
ConflictException - - destination folder does not exist.
MultistatusException - - errors has occured during processing of the subtree. Every item that has been eithre successfully copied or failed to copy must be present in exception with corresponding status.
ServerException - - In case of other error.

moveTo

void moveTo(Folder folder,
            java.lang.String destName)
            throws LockedException,
                   ConflictException,
                   MultistatusException,
                   ServerException
Moves this item to the destination folder under a new name.

Parameters:
folder - Destination folder.
destName - Name of the destination item.
Throws:
LockedException - - the source or the destination item was locked and client did not provide lock token.
ConflictException - - destination folder does not exist.
MultistatusException - - errors has occured during processing of the subtree. Every processed item must have corresponding response added with corresponding status.
ServerException - - in case of another error.

delete

void delete()
            throws LockedException,
                   MultistatusException,
                   ServerException
Deletes this item.

Throws:
LockedException - - this item or its parent was locked and client did not provide lock token.
MultistatusException - - errors has occured during processing of the subtree. Every processed item must have corresponding response added to the exception with corresponding status.
ServerException - - in case of another error.


Copyright © 2009 ITHit. All Rights Reserved.