org.olat.core.util.vfs
Class NamedLeaf

java.lang.Object
  extended by org.olat.core.util.vfs.NamedLeaf
All Implemented Interfaces:
VFSItem, VFSLeaf

public class NamedLeaf
extends java.lang.Object
implements VFSLeaf

Description:

The named leaf takes an existing VFSLeaf and wraps it with another name. This is handy to display items using another name than the real filesystem name. Most methods are delegated to the original VFSLeaf

Initial Date: 30.05.2007

Author:
Florian Gnaegi, frentix GmbH, http://www.frentix.com

Constructor Summary
NamedLeaf(java.lang.String name, VFSLeaf delegate)
          Constructor
 
Method Summary
 VFSStatus canCopy()
           
 VFSStatus canDelete()
           
 VFSStatus canRename()
           
 VFSStatus canWrite()
           
 VFSStatus delete()
          deltes the item.
 java.io.InputStream getInputStream()
           
 long getLastModified()
          Return the last modified date of this item or -1 if not available.
 VFSSecurityCallback getLocalSecurityCallback()
          Get the local security callback for this item.
 java.lang.String getName()
           
 java.io.OutputStream getOutputStream(boolean append)
           
 VFSContainer getParentContainer()
          Get the parent of this vfsItem.
 long getSize()
           
 boolean isSame(VFSItem vfsItem)
          Test if this is the same item as ourselves.
 VFSStatus rename(java.lang.String newname)
           
 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 java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedLeaf

public NamedLeaf(java.lang.String name,
                 VFSLeaf delegate)
Constructor

Parameters:
name - Name under which the leaf should appear
delegate - The delegate leaf
Method Detail

getInputStream

public java.io.InputStream getInputStream()
Specified by:
getInputStream in interface VFSLeaf
Returns:
is or null (if e.g. the underlying file no longer exists)
See Also:
VFSLeaf.getInputStream()

getOutputStream

public java.io.OutputStream getOutputStream(boolean append)
Specified by:
getOutputStream in interface VFSLeaf
Returns:
os
See Also:
VFSLeaf.getOutputStream(boolean)

getSize

public long getSize()
Specified by:
getSize in interface VFSLeaf
Returns:
size
See Also:
VFSLeaf.getSize()

canCopy

public VFSStatus canCopy()
Specified by:
canCopy in interface VFSItem
Returns:
true if this container (and all its children recursively) can be copied to some other place. this is normally true for containers with a physical implementation, but not for virtual/named containers
See Also:
VFSItem.canCopy()

canDelete

public VFSStatus canDelete()
Specified by:
canDelete in interface VFSItem
Returns:
if can delete
See Also:
VFSItem.canDelete()

canRename

public VFSStatus canRename()
Specified by:
canRename in interface VFSItem
Returns:
if can write
See Also:
VFSItem.canRename()

canWrite

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

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
Returns:
status
See Also:
VFSItem.delete()

getLastModified

public long getLastModified()
Description copied from interface: VFSItem
Return the last modified date of this item or -1 if not available.

Specified by:
getLastModified in interface VFSItem
Returns:
See Also:
VFSItem.getLastModified()

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.

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

getName

public java.lang.String getName()
Specified by:
getName in interface VFSItem
Returns:
the name
See Also:
VFSItem.getName()

getParentContainer

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

Specified by:
getParentContainer in interface VFSItem
Returns:
See Also:
VFSItem.getParentContainer()

isSame

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

Specified by:
isSame in interface VFSItem
Returns:
See Also:
VFSItem.isSame(org.olat.core.util.vfs.VFSItem)

rename

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

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:
VFSItem.resolve(java.lang.String)

setLocalSecurityCallback

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

Specified by:
setLocalSecurityCallback in interface VFSItem
See Also:
VFSItem.setLocalSecurityCallback(org.olat.core.util.vfs.callbacks.VFSSecurityCallback)

setParentContainer

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

Specified by:
setParentContainer in interface VFSItem
See Also:
VFSItem.setParentContainer(org.olat.core.util.vfs.VFSContainer)