org.olat.core.util.vfs
Class MergeSource

java.lang.Object
  extended by org.olat.core.util.vfs.AbstractVirtualContainer
      extended by org.olat.core.util.vfs.MergeSource
All Implemented Interfaces:
VFSContainer, VFSItem

public class MergeSource
extends AbstractVirtualContainer

Description:
TODO: Felix Jost Class Description for MultiSource

Initial Date: 23.06.2005

Author:
Felix Jost

Constructor Summary
MergeSource(VFSContainer parentContainer, java.lang.String name)
           
 
Method Summary
 void addContainer(VFSContainer container)
          Add container to this merge source.
 void addContainersChildren(VFSContainer container, boolean enableWrite)
          Add all children of this container to the root of this MergeSource.
 VFSStatus canWrite()
           
 VFSStatus copyFrom(VFSItem source)
          copy either a file or a folder to this folder.
 VFSContainer createChildContainer(java.lang.String name)
          Create a new child container (of same type) if possible.
 VFSLeaf createChildLeaf(java.lang.String name)
          Create a new leaf (of same type) if possible,
 java.util.List getItems()
           
 java.util.List getItems(VFSItemFilter filter)
           
 VFSSecurityCallback getLocalSecurityCallback()
          Get the local security callback for this item.
 VFSContainer getParentContainer()
          Get the parent of this vfsItem.
 VFSContainer getRootWriteContainer()
           
 boolean isSame(VFSItem vfsItem)
          Test if this is the same item as ourselves.
 VFSItem resolve(java.lang.String path)
          a relative path.
 void setLocalSecurityCallback(VFSSecurityCallback secCallback)
          Set a custom security callback for this item.
 void setParentContainer(VFSContainer parentContainer)
          Sets the parent container.
 
Methods inherited from class org.olat.core.util.vfs.AbstractVirtualContainer
canCopy, canDelete, canRename, delete, getDefaultItemFilter, getLastModified, getName, rename, setDefaultItemFilter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeSource

public MergeSource(VFSContainer parentContainer,
                   java.lang.String name)
Method Detail

addContainer

public void addContainer(VFSContainer container)
Add container to this merge source. container will show up as its name as a childe of MergeSource.

Parameters:
container -

addContainersChildren

public void addContainersChildren(VFSContainer container,
                                  boolean enableWrite)
Add all children of this container to the root of this MergeSource.

Parameters:
container -
enableWrite - If true, writes to the root of this MergeSource are directed to this container.

getParentContainer

public VFSContainer getParentContainer()
Description copied from interface: VFSItem
Get the parent of this vfsItem.

Returns:
See Also:
org.olat.core.util.vfs.VFSItem#getParent()

setParentContainer

public void setParentContainer(VFSContainer parentContainer)
Description copied from interface: VFSItem
Sets the parent container. -> DO NOT CALL THIS METHOD... USED ONLY INTERNALLY!

See Also:
VFSItem.setParentContainer(org.olat.core.util.vfs.VFSContainer)

getItems

public java.util.List getItems()
Returns:
a list of VFSItem containing
See Also:
VFSContainer.getItems()

getItems

public java.util.List getItems(VFSItemFilter filter)
Returns:
a list of VFSItem which are accepted by the given filter. If a default filter is set, the default filter will be applied in addition to the given filter in this method
See Also:
VFSContainer.getItems(org.olat.core.util.vfs.filters.VFSItemFilter)

canWrite

public VFSStatus canWrite()
Returns:
true if a child can be added at all(only files and folder cab be copied to). the operation may still fail because e.g. of quota limitation.
See Also:
org.olat.core.util.vfs.VFSItem#canCopyTo()

createChildContainer

public VFSContainer createChildContainer(java.lang.String name)
Description copied from interface: VFSContainer
Create a new child container (of same type) if possible.

Specified by:
createChildContainer in interface VFSContainer
Overrides:
createChildContainer in class AbstractVirtualContainer
Returns:
VFSItem if successfull, null otherwise.
See Also:
VFSContainer.createChildContainer(java.lang.String)

createChildLeaf

public VFSLeaf createChildLeaf(java.lang.String name)
Description copied from interface: VFSContainer
Create a new leaf (of same type) if possible,

Specified by:
createChildLeaf in interface VFSContainer
Overrides:
createChildLeaf in class AbstractVirtualContainer
Returns:
VFSItem if successfull, null otherwise.
See Also:
VFSContainer.createChildLeaf(java.lang.String)

copyFrom

public VFSStatus copyFrom(VFSItem source)
Description copied from interface: VFSContainer
copy either a file or a folder to this folder. e.g. this folder is based at /bla/blu, copying source bli (from /whatever/bli) will add a child bli, so it looks like /bla/blu/bli later. the operation fails when the source or target do not support canCopyFrom and canCopyTo, resp., or there is already a child with the same name, or the quota would be exceeded.

Specified by:
copyFrom in interface VFSContainer
Overrides:
copyFrom in class AbstractVirtualContainer
Parameters:
source - the source (must exist)
Returns:
the status
See Also:
VFSContainer.copyFrom(org.olat.core.util.vfs.VFSItem)

resolve

public VFSItem resolve(java.lang.String path)
Description copied from interface: VFSItem
a relative path. the implementation will search all its children. e.g. bla/blu/bli.txt this vfsitem's name must thus be 'bla'

Returns:
See Also:
org.olat.core.util.vfs.VFSItem#resolveFile(java.lang.String)

getLocalSecurityCallback

public VFSSecurityCallback getLocalSecurityCallback()
Description copied from interface: VFSItem
Get the local security callback for this item. NOTE: Usually you would not need to access local security callbacks directly. You'd rather want to get the inherited security callback of this item via getInheritedSecurityCallback. This will get you the local security callback if set aswell but also any inherited security callbacks from parent containers.

Returns:
SecurityCallback if any, or null if not set.
See Also:
VFSItem.getLocalSecurityCallback()

setLocalSecurityCallback

public void setLocalSecurityCallback(VFSSecurityCallback secCallback)
Description copied from interface: VFSItem
Set a custom security callback for this item.

See Also:
VFSItem.setLocalSecurityCallback(org.olat.core.util.vfs.callbacks.VFSSecurityCallback)

isSame

public boolean isSame(VFSItem vfsItem)
Description copied from interface: VFSItem
Test if this is the same item as ourselves.

Returns:

getRootWriteContainer

public VFSContainer getRootWriteContainer()