pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.vfs.filebrowser
Class VFSDirectoryDescriptor

java.lang.Object
  extended by org.torweg.pulse.vfs.filebrowser.AbstractDescriptor
      extended by org.torweg.pulse.vfs.filebrowser.VFSDirectoryDescriptor
All Implemented Interfaces:
java.lang.Comparable<DirectoryDescriptor>, JDOMable, INamed, DirectoryDescriptor

public class VFSDirectoryDescriptor
extends AbstractDescriptor
implements DirectoryDescriptor

is a DirectoryDescriptor for directories in the VirtualFileSystem.

Version:
$Revision: 1430 $
Author:
Thomas Weber, Daniel Dietz

Nested Class Summary
static class VFSDirectoryDescriptor.FileBrowserActions
          contains the different actions of the FileBrowser as constants.
 
Constructor Summary
protected VFSDirectoryDescriptor()
          Default constructor.
  VFSDirectoryDescriptor(VirtualFile f)
          builds a new VFSDirectoryDescriptor for the given directory.
 
Method Summary
 Command buildListDirectoriesCommand(Command template, User u, int i)
          builds a Command which lists the child DirectoryDescriptors of the DirectoryDescriptor .
 Command buildListFilesCommand(Command template, User u, int i)
          builds a Command which lists the child FileDescriptors of the DirectoryDescriptor.
 int compareTo(DirectoryDescriptor f)
          compares the name of the given DirectoryDescriptor with the name of the DirectoryDescriptor.
 org.jdom.Element deserializeToJDOM()
          deserialises the descriptor.
 boolean equals(java.lang.Object o)
           
 java.util.List<VFSDirectoryDescriptor> getChildren(User u)
          returns the child directories of the DirectoryDescriptor.
 VirtualFile getDir()
          returns the VirtualFile of the DirectoryDescriptor.
 java.util.List<VFSFileDescriptor> getFiles(User u)
          returns the files of the DirectoryDescriptor.
 java.lang.String getName()
          returns the name of the directory.
 java.net.URI getURI()
          returns the URI for the DirectoryDescriptor.
 int hashCode()
           
 net.sf.json.JSONObject toJSON()
          returns a JSON-representation of the VFSDirectoryDescriptor.
 
Methods inherited from class org.torweg.pulse.vfs.filebrowser.AbstractDescriptor
getServiceRequest, insertVirtualFileInformation, setServiceRequest
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.torweg.pulse.vfs.filebrowser.DirectoryDescriptor
setServiceRequest
 

Constructor Detail

VFSDirectoryDescriptor

protected VFSDirectoryDescriptor()
Default constructor.


VFSDirectoryDescriptor

public VFSDirectoryDescriptor(VirtualFile f)
builds a new VFSDirectoryDescriptor for the given directory.

Parameters:
f - the directory
Method Detail

getChildren

public final java.util.List<VFSDirectoryDescriptor> getChildren(User u)
                                                         throws java.io.IOException
returns the child directories of the DirectoryDescriptor.

Specified by:
getChildren in interface DirectoryDescriptor
Parameters:
u - the user who is accessing the directory
Returns:
the child directories of the DirectoryDescriptor
Throws:
java.io.IOException - on I/O errors
See Also:
DirectoryDescriptor.getChildren(User)

getFiles

public final java.util.List<VFSFileDescriptor> getFiles(User u)
                                                 throws java.io.IOException
returns the files of the DirectoryDescriptor.

Specified by:
getFiles in interface DirectoryDescriptor
Parameters:
u - the user who is accessing the directory
Returns:
the files of the DirectoryDescriptor
Throws:
java.io.IOException - on I/O errors
See Also:
DirectoryDescriptor.getFiles(User)

deserializeToJDOM

public final org.jdom.Element deserializeToJDOM()
deserialises the descriptor.

Specified by:
deserializeToJDOM in interface JDOMable
Returns:
a JDOM deserialisation

buildListDirectoriesCommand

public final Command buildListDirectoriesCommand(Command template, User u,
                                                 int i)
builds a Command which lists the child DirectoryDescriptors of the DirectoryDescriptor .

Specified by:
buildListDirectoriesCommand in interface DirectoryDescriptor
Parameters:
template - the Command to be used as a template
u - the User to be used for access checks
i - the id of the BrowsingAdapter
Returns:
a Command which lists the child DirectoryDescriptors of the DirectoryDescriptor or null, if User.hasAllowanceFor(Command) returns false
See Also:
Command

buildListFilesCommand

public final Command buildListFilesCommand(Command template, User u,
                                           int i)
builds a Command which lists the child FileDescriptors of the DirectoryDescriptor.

Specified by:
buildListFilesCommand in interface DirectoryDescriptor
Parameters:
template - the Command to be used as a template
u - the User to be used for access checks
i - the id of the BrowsingAdapter
Returns:
a Command which lists the child FileDescriptors of the DirectoryDescriptor or null, if User.hasAllowanceFor(Command) returns false
See Also:
Command

getName

public final java.lang.String getName()
returns the name of the directory.

Specified by:
getName in interface INamed
Specified by:
getName in interface DirectoryDescriptor
Returns:
the name of the directory

getURI

public final java.net.URI getURI()
returns the URI for the DirectoryDescriptor.

Specified by:
getURI in interface DirectoryDescriptor
Returns:
the URI for the DirectoryDescriptor

getDir

public VirtualFile getDir()
returns the VirtualFile of the DirectoryDescriptor.

Specified by:
getDir in interface DirectoryDescriptor
Returns:
the VirtualFile of the DirectoryDescriptor

compareTo

public final int compareTo(DirectoryDescriptor f)
compares the name of the given DirectoryDescriptor with the name of the DirectoryDescriptor.

Specified by:
compareTo in interface java.lang.Comparable<DirectoryDescriptor>
Parameters:
f - the DirectoryDescriptor to compare with
Returns:
the result of the string comparison

equals

public final boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare to
Returns:
true, if the directory names match in lower case.

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code for the VFSDirectoryDescriptor
See Also:
Object.hashCode()

toJSON

public final net.sf.json.JSONObject toJSON()
returns a JSON-representation of the VFSDirectoryDescriptor.

Specified by:
toJSON in interface DirectoryDescriptor
Returns:
a JSON-representation of the VFSDirectoryDescriptor