uk.ac.rdg.resc.jstyx.server
Class DirectoryOnDisk

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.server.StyxFile
      extended by uk.ac.rdg.resc.jstyx.server.StyxDirectory
          extended by uk.ac.rdg.resc.jstyx.server.DirectoryOnDisk

public class DirectoryOnDisk
extends StyxDirectory

Class representing a directory on a hard disk (i.e. in the host filesystem) See also FileOnDisk. To create a new file on the hard disk, use createChild().

Author:
Jon Blower $Revision: 507 $ $Date: 2005-12-01 08:21:56 +0000 (Thu, 01 Dec 2005) $ $Log$ Revision 1.7 2005/12/01 08:21:56 jonblower Fixed javadoc comments Revision 1.6 2005/06/20 17:21:26 jonblower Bug fix (listFiles() returns null if no permissions to read directory) Revision 1.5 2005/05/26 16:50:29 jonblower Made static method createFileOrDirectory() Revision 1.4 2005/05/19 14:46:51 jonblower Changed behaviour of StyxDirectory.createChild(): no longer adds file to namespace in this method Revision 1.3 2005/05/09 07:13:52 jonblower Changed getFileOnDisk() to getFileOrDirectoryOnDisk() Revision 1.2 2005/04/28 08:11:15 jonblower Modified permissions handling in documentation directory of SGS Revision 1.1.1.1 2005/02/16 18:58:31 jonblower Initial import

Field Summary
protected  java.io.File dir
           
 
Fields inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile
auth, directory, lastModifiedTime, name, parent
 
Constructor Summary
DirectoryOnDisk(java.io.File dir)
           
DirectoryOnDisk(java.lang.String filename)
           
 
Method Summary
 StyxFile createChild(java.lang.String name, int perm, boolean isDir, boolean isAppOnly, boolean isExclusive)
          Creates a new file and adds it to this directory.
static StyxFile createFileOrDirectory(java.io.File f, boolean isDir, int perm)
          Creates a file or directory, wraps it as a StyxFile with the given permissions and returns it
protected  void delete()
          Removes the underlying directory from the disk
protected  void refresh(boolean updateChildren)
          Reads all metadata from underlying disk file
 
Methods inherited from class uk.ac.rdg.resc.jstyx.server.StyxDirectory
addChild, checkSetLength, childExists, getChild, getChildren, getFullPath, getLength, getName, getNumChildren, getParent, isRoot, read, refresh, remove, removeAllChildren, removeChild, write
 
Methods inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile
addChangeListener, addClient, checkSetLastModifiedTime, checkSetMode, checkSetName, clientConnected, clientDisconnected, contentsChanged, fireContentsChanged, getClient, getDirEntry, getGroup, getNumClients, getOwner, getPermissions, getQid, getVersion, incrementVersion, isAppendOnly, isAuth, isDirectory, isExclusive, processAndReplyRead, processAndReplyRead, processAndReplyRead, removeChangeListener, removeClient, rename, replyRead, replyRead, replyRead, replyRead, replyRead, replyWrite, setLastAccessTime, setLastModified, setLength, setMode, setName, setPermissions, setReadOnly
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dir

protected java.io.File dir
Constructor Detail

DirectoryOnDisk

public DirectoryOnDisk(java.lang.String filename)
                throws StyxException
Throws:
StyxException

DirectoryOnDisk

public DirectoryOnDisk(java.io.File dir)
                throws StyxException
Throws:
StyxException
Method Detail

refresh

protected void refresh(boolean updateChildren)
Reads all metadata from underlying disk file

Overrides:
refresh in class StyxDirectory
Parameters:
updateChildren - if this is true, all the immediate children of this directory will be updated (this parameter is meaningless if this is not a directory)

createChild

public StyxFile createChild(java.lang.String name,
                            int perm,
                            boolean isDir,
                            boolean isAppOnly,
                            boolean isExclusive)
                     throws StyxException
Creates a new file and adds it to this directory. This method will create a new file in the underlying filesystem, then return it. A StyxException will be thrown if isAppOnly or isExclusive is true.

Overrides:
createChild in class StyxDirectory
Returns:
The newly-created file
Throws:
StyxException

delete

protected void delete()
Removes the underlying directory from the disk

Overrides:
delete in class StyxFile

createFileOrDirectory

public static StyxFile createFileOrDirectory(java.io.File f,
                                             boolean isDir,
                                             int perm)
                                      throws StyxException
Creates a file or directory, wraps it as a StyxFile with the given permissions and returns it

Parameters:
f - The java.io.File to be created
isDir - True if the file to be created is a directory
perm - The permissions to give the StyxFile
Throws:
StyxException


Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.