com.ibm.portal.resolver.webdav.tree.helper
Class DefaultWebdavTreeModelController<T,M extends Modifiable>

java.lang.Object
  extended by com.ibm.portal.resolver.webdav.tree.helper.DefaultWebdavTreeModel<T>
      extended by com.ibm.portal.resolver.webdav.tree.helper.DefaultWebdavTreeModelController<T,M>
All Implemented Interfaces:
Committable, Disposable, WebdavTreeModel<T>, WebdavTreeModelController<T,M>

public class DefaultWebdavTreeModelController<T,M extends Modifiable>
extends DefaultWebdavTreeModel<T>
implements WebdavTreeModelController<T,M>

Convenience base class for WebdavTreeModelController implementations.

Since:
6.1.5
Note:
This interface is designed to be implemented by clients.

Field Summary
 
Fields inherited from interface com.ibm.portal.resolver.webdav.tree.WebdavTreeModelController
FLAG_COLLECTION, FLAG_FILE
 
Constructor Summary
DefaultWebdavTreeModelController()
           
 
Method Summary
 void commit()
          Commits the modifications applied to the controller that implements this interface.
 WebdavCreationContext<T> createCreationContext(java.lang.String name, boolean isCollection, java.io.InputStream is, T parent)
          Returns a new creation context to create a new item inside a parent collection.
 TreeModelController<T,M> getTreeModelController()
          Creates a new CommittableTreeModelController used to execute modification operations on the tree.
 boolean update(M item, java.io.InputStream is)
          This method updates the modifiable item with the content of the input stream.
 
Methods inherited from class com.ibm.portal.resolver.webdav.tree.helper.DefaultWebdavTreeModel
createDataSource, dispose, getItem, getLocalized, getName, getTreeModel, isCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.portal.resolver.webdav.tree.WebdavTreeModel
createDataSource, getItem, getLocalized, getName, getTreeModel, isCollection
 
Methods inherited from interface com.ibm.portal.Committable
dispose
 

Constructor Detail

DefaultWebdavTreeModelController

public DefaultWebdavTreeModelController()
Method Detail

createCreationContext

public WebdavCreationContext<T> createCreationContext(java.lang.String name,
                                                      boolean isCollection,
                                                      java.io.InputStream is,
                                                      T parent)
Description copied from interface: WebdavTreeModelController
Returns a new creation context to create a new item inside a parent collection. Depending on the isCollection parameter the new item can contain subitems or not.

Specified by:
createCreationContext in interface WebdavTreeModelController<T,M extends Modifiable>
Parameters:
name - name of the new collection or item, not null. The name will not contain the path separator '/' and will not be URL encoded.
isCollection - true if the new item is a collection, else false
is - in case a non-collection is created this stream contains the content of the newly created item and will not be null. In case a collection is created, this stream may be null or contains the optional request body of the MKCOL request.
parent - the parent collection, not null. This information can be used as a hint for the target insert location. In any case the new node will be explicitly inserted as the child of the parent collection after it has been created.
Returns:
a creation context or null

getTreeModelController

public TreeModelController<T,M> getTreeModelController()
Description copied from interface: WebdavTreeModelController
Creates a new CommittableTreeModelController used to execute modification operations on the tree. If no modifications are allowed, this method may return null

Specified by:
getTreeModelController in interface WebdavTreeModelController<T,M extends Modifiable>
Returns:
the controller or null

update

public boolean update(M item,
                      java.io.InputStream is)
               throws java.io.IOException
Description copied from interface: WebdavTreeModelController
This method updates the modifiable item with the content of the input stream. If the update is successful, the method returns true , else it returns false. After a successful update the new content of the item must be available via the WebdavTreeModel.createDataSource(T) APIs.

Specified by:
update in interface WebdavTreeModelController<T,M extends Modifiable>
Parameters:
item - item to update, not null
is - the (new) content of the item, not null
Returns:
true if the operation was successful, else false
Throws:
java.io.IOException

commit

public void commit()
            throws CannotCommitException
Description copied from interface: Committable
Commits the modifications applied to the controller that implements this interface. Implementations of this method must not perform database read access.

After the controller is committed successfully, this method must not be called again. The same is true for any other method modifying the controller or its nodes.

Specified by:
commit in interface Committable
Throws:
CannotCommitException - in case the modifications cannot be committed; if this exception occurs, the commit operation is considered unsuccessfully executed