com.ibm.portal.resolver.webdav.tree
Interface WebdavTreeModel<T>

All Superinterfaces:
Disposable
All Known Subinterfaces:
WebdavAccessControlTreeModel<T>, WebdavCopyableTreeModelController<T,M>, WebdavLockableTreeModel<T>, WebdavLockableTreeModelController<T,M>, WebdavPropertiesTreeModel<T>, WebdavRenameableTreeModelController<T,M>, WebdavTreeModelController<T,M>
All Known Implementing Classes:
DefaultWebdavTreeModel, DefaultWebdavTreeModelController

public interface WebdavTreeModel<T>
extends Disposable

Model description of a WebDAV hierarchy. Information such as the content type, the timestamps or the size of the data are retrieved via the DataSource interface returned by createDataSource(Object).

The items returned by the model should implement the Object.equals(Object) and Object.hashCode() methods.

Implementations MAY in addition implement subclassed of WebdavTreeModel to expose advanced functionality:

Locking
WebdavLockableTreeModel
Extended Properties
WebdavPropertiesTreeModel

Since:
6.1.5
See Also:
WebdavLockableTreeModel, WebdavPropertiesTreeModel
Note:
This interface is designed to be implemented by clients.

Method Summary
 DataSource createDataSource(T item)
           Creates a new DataSource for the given item.
 T getItem(java.net.URI uri)
          Returns an existing item that corresponds to the URI.
 Localized getLocalized(T item)
           Returns an object that provides the localizations for an arbitrary item out of those items available in the getTreeModel().
 java.lang.String getName(T item)
           Returns the "friendly" name for for an arbitrary item out of those items available in the getTreeModel().
 TreeModel<T> getTreeModel()
          Returns the TreeModel that describes the namespace hierarchy of items.
 boolean isCollection(T item)
           Checks if any item is a collection or a 'file'.
 
Methods inherited from interface com.ibm.portal.Disposable
dispose
 

Method Detail

createDataSource

DataSource createDataSource(T item)
                            throws java.io.IOException

Creates a new DataSource for the given item. This information is used to download a particular resource. The method may also return null to indicate that the item does not have a representation. The data source can implement the ContentDispositionDataSource or ContentLengthDataSource to indicate the size of the data.

Clients of this method must make sure that they call Disposable.dispose() on the created data source when it is no longer needed.

The DataSource is also used to compute the following WebDAV properties:

creationdate
Records the time and date the resource was created.
getcontentlength
Contains the Content-Length header returned by a GET without accept headers. Requires that the DataSource implements the ContentDispositionDataSource or ContentLengthDataSource interface.
getcontenttype
Contains the Content-Type header returned by a GET without accept headers.
getetag
Contains the ETag header returned by a GET without accept headers. Requires that the DataSource implements the DataSourceChecksum interface.
getlastmodified
Contains the Last-Modified header returned by a GET method without accept headers.

Parameters:
item - item, not null
Returns:
the data source or null
Throws:
java.io.IOException

getItem

T getItem(java.net.URI uri)
          throws java.io.IOException
Returns an existing item that corresponds to the URI. If the item cannot be found, then this method MUST return null.

Parameters:
uri - the URI of the item, not null
Returns:
the corresponding item or null
Throws:
java.io.IOException

getLocalized

Localized getLocalized(T item)
                       throws java.io.IOException

Returns an object that provides the localizations for an arbitrary item out of those items available in the getTreeModel(). If there are not localizations available the method MAY return null.

The Localized object us used to compute the following WebDAV properties:

displayname
Provides a name for the resource that is suitable for presentation to a user.
getcontentlanguage
Contains the Content-Language header returned by a GET without accept headers

Parameters:
item - item, not null
Returns:
localizations or null
Throws:
java.io.IOException

getName

java.lang.String getName(T item)
                         throws java.io.IOException

Returns the "friendly" name for for an arbitrary item out of those items available in the getTreeModel(). This name should not contain path separator characters. The final URL path is build from the hierarchy of these names. The getItem(URI) must be prepared to locate the addressed item based on the path constructed from these names. The name may contain all unicode characters and does not need to be URL encoded, i.e. a name "a b" is perfectly valid and does not need to be encoded to be "a%20b".

Parameters:
item - item, not null
Returns:
the name, must not be null nor the empty string
Throws:
java.io.IOException

getTreeModel

TreeModel<T> getTreeModel()
Returns the TreeModel that describes the namespace hierarchy of items.

Returns:
the tree model, must not be null

isCollection

boolean isCollection(T item)
                     throws java.io.IOException

Checks if any item is a collection or a 'file'. Collections may contain children whereas non-collection resources cannot. This information is not redundant to TreeModel.hasChildren(Object) because the tree model checks if a node actually contains children, whereas isCollection(Object) checks if a node MAY contain children.

This information is used to compute the following WebDAV properties:

resourcetype
Specifies the nature of the resource.

Parameters:
item - the item, not null
Returns:
true if the item may contain children, else false
Throws:
java.io.IOException