public interface HierarchyItem
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.
| Modifier and Type | Method and Description |
|---|---|
void |
copyTo(Folder folder,
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).
|
String |
getName()
Gets the name of the item in repository.
|
String |
getPath()
Unique item path in the repository relative to storage root.
|
List<Property> |
getProperties(Property[] props)
Gets values of all properties or selected properties for this item.
|
List<Property> |
getPropertyNames()
Gets names of all properties for this item.
|
void |
moveTo(Folder folder,
String destName)
Moves this item to the destination folder under a new name.
|
void |
updateProperties(Property[] setProps,
Property[] delProps)
Adds, modifies and removes properties for this item.
|
String getName() throws ServerException
ServerException - In case of an error.long getCreated()
throws ServerException
ServerException - In case of an error.long getModified()
throws ServerException
ServerException - In case of an error.String getPath() throws ServerException
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 DavRequest.getContextPath() property and attach it to url returned by this property.
Examples:
ServerException - In case of an error.List<Property> getProperties(Property[] props) throws ServerException
props - null to get all properties.
ServerException - In case of an error.
<<<< getPropertiesImpl >>>>List<Property> getPropertyNames() throws ServerException
Most WebDAV clients never request list of property names, so your implementation can just throw ServerException
with WebDavStatus.NOT_ALLOWED status.
ServerException - In case of an error.
<<<< getPropertyNamesImpl >>>>void updateProperties(Property[] setProps, Property[] delProps) throws LockedException, MultistatusException, ServerException
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.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.
<<<< updatePropertiesImpl >>>>void copyTo(Folder folder, String destName, boolean deep) throws LockedException, ConflictException, MultistatusException, ServerException
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.
folder - Destination folder.destName - Name of the destination item.deep - Indicates whether to copy entire subtree.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.
<<<< copyToFolderImpl >>>>void moveTo(Folder folder, String destName) throws LockedException, ConflictException, MultistatusException, ServerException
folder - Destination folder.destName - Name of the destination item.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.
<<<< moveToFolderImpl >>>>void delete()
throws LockedException,
MultistatusException,
ServerException
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.
<<<< deleteFolderImpl >>>>Copyright © ITHit. All Rights Reserved.