org.olat.core.util.vfs
Class LocalFolderImpl

java.lang.Object
  extended by org.olat.core.util.vfs.LocalImpl
      extended by org.olat.core.util.vfs.LocalFolderImpl
All Implemented Interfaces:
VFSContainer, VFSItem
Direct Known Subclasses:
OlatRootFolderImpl

public class LocalFolderImpl
extends LocalImpl
implements VFSContainer

Description:
VFSContainer implementation that is based on a java.io.File from a local filesystem. It implements a regular directory

Initial Date: 23.06.2005

Author:
Felix Jost

Constructor Summary
LocalFolderImpl(java.io.File folderFile)
          Constructor
 
Method Summary
 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,
 VFSStatus delete()
          deltes the item.
 VFSItemFilter getDefaultItemFilter()
           
 java.util.List<VFSItem> getItems()
           
 java.util.List<VFSItem> getItems(VFSItemFilter filter)
           
 VFSStatus rename(java.lang.String newname)
           
 VFSItem resolve(java.lang.String path)
          a relative path.
 void setDefaultItemFilter(VFSItemFilter defaultFilter)
          Set a default filter that will be applied to this container getItems method
 java.lang.String toString()
           
 
Methods inherited from class org.olat.core.util.vfs.LocalImpl
canCopy, canDelete, canRename, getBasefile, getLastModified, getLocalSecurityCallback, getName, getParentContainer, isSame, setLocalSecurityCallback, setParentContainer
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.olat.core.util.vfs.VFSItem
canCopy, canDelete, canRename, getLastModified, getLocalSecurityCallback, getName, getParentContainer, isSame, setLocalSecurityCallback, setParentContainer
 

Constructor Detail

LocalFolderImpl

public LocalFolderImpl(java.io.File folderFile)
Constructor

Parameters:
folderFile - The real file of type directory wrapped by this VFSContainer
Method Detail

getItems

public java.util.List<VFSItem> getItems()
Specified by:
getItems in interface VFSContainer
Returns:
a list of VFSItem containing
See Also:
VFSContainer.getItems()

getItems

public java.util.List<VFSItem> getItems(VFSItemFilter filter)
Specified by:
getItems in interface VFSContainer
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)

setDefaultItemFilter

public void setDefaultItemFilter(VFSItemFilter defaultFilter)
Description copied from interface: VFSContainer
Set a default filter that will be applied to this container getItems method

Specified by:
setDefaultItemFilter in interface VFSContainer
See Also:
VFSContainer.setDefaultItemFilter(org.olat.core.util.vfs.filters.VFSItemFilter)

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
Parameters:
source - the source (must exist)
Returns:
the status
See Also:
VFSContainer.copyFrom(org.olat.core.util.vfs.VFSItem)

canWrite

public VFSStatus canWrite()
Specified by:
canWrite in interface VFSItem
Overrides:
canWrite in class LocalImpl
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:
VFSItem.canWrite()

rename

public VFSStatus rename(java.lang.String newname)
Specified by:
rename in interface VFSItem
Specified by:
rename in class LocalImpl
Parameters:
newname - e.g test.txt or myfolder (no path prepended)
Returns:
status
See Also:
VFSItem.rename(java.lang.String)

delete

public VFSStatus delete()
Description copied from interface: VFSItem
deltes the item. if the item is a container, all children will be deleted recursively

Specified by:
delete in interface VFSItem
Specified by:
delete in class LocalImpl
Returns:
status
See Also:
VFSItem.delete()

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'

Specified by:
resolve in interface VFSItem
Returns:
See Also:
org.olat.core.util.vfs.VFSItem#resolveFile(java.lang.String)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

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
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
Returns:
VFSItem if successfull, null otherwise.
See Also:
VFSContainer.createChildLeaf(java.lang.String)

getDefaultItemFilter

public VFSItemFilter getDefaultItemFilter()
Specified by:
getDefaultItemFilter in interface VFSContainer
Returns:
The default filter for this container or NULL if no filter is set
See Also:
VFSContainer.getDefaultItemFilter()