dk.apaq.vfs.impl.cifs
Class CifsNode

java.lang.Object
  extended by dk.apaq.vfs.impl.cifs.CifsNode
All Implemented Interfaces:
Node, Serializable, Comparable
Direct Known Subclasses:
CifsDirectory, CifsFile

public abstract class CifsNode
extends Object
implements Node

Author:
mzk
See Also:
Serialized Form

Constructor Summary
CifsNode(CifsFileSystem filesystem, jcifs.smb.SmbFile file)
           
CifsNode(CifsFileSystem filesystem, String url)
           
 
Method Summary
 boolean canRead()
          Retrieves information about wether access to read is allowed.
 boolean canWrite()
          Retrieves information about wether access to read is allowed.
 int compareTo(Node node)
          Compare this node to another node by comparing their names.
 int compareTo(Object arg0)
           
 void delete()
          Deletes the node.
protected  void deleteRecursive(jcifs.smb.SmbFile file)
           
 boolean equals(Node node)
           
 boolean equals(Object o)
           
 String getBaseName()
          Retrieves the name without suffix like this: myimage.jpg = myimage mybundle.app = mybundle testfile.dit.dat = testfile.dit testdir = testdir
 FileSystem getFileSystem()
          Retrieves the filesystem which this node belongs to.
 Date getLastModified()
          Retrieves the date for last modification.
 String getName()
          Retrieves the name of the node.
 Directory getParent()
          Retrieves the parent directory of this node.
 Path getPath()
           
 String getSuffix()
          Retrieves the suffix of the node or null if no suffix, like this:.
 boolean isDirectory()
          Checks wether this node is a directory.
 boolean isFile()
          Checks wether this node is a file.
 boolean isHidden()
          Checks wether this node is hidden.
 boolean isRoot()
           
 void moveTo(Directory newParent)
          Moves this node to a new directory.
 void moveTo(Directory newParent, String newName)
          Moves this node to a new directory and renames it.
 void setLastModified(Date date)
          Sets the date for last modification.
 void setName(String name)
          Renames the node.
 URI toUri()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CifsNode

public CifsNode(CifsFileSystem filesystem,
                jcifs.smb.SmbFile file)

CifsNode

public CifsNode(CifsFileSystem filesystem,
                String url)
         throws MalformedURLException
Throws:
MalformedURLException
Method Detail

deleteRecursive

protected void deleteRecursive(jcifs.smb.SmbFile file)
                        throws IOException
Throws:
IOException

moveTo

public void moveTo(Directory newParent)
            throws IOException
Description copied from interface: Node
Moves this node to a new directory.

Specified by:
moveTo in interface Node
Parameters:
newParent - The directory the node should be moved to.
Throws:
IOException - Thrown if an error occurs while the node is being moved.

moveTo

public void moveTo(Directory newParent,
                   String newName)
            throws IOException
Description copied from interface: Node
Moves this node to a new directory and renames it.

Specified by:
moveTo in interface Node
Parameters:
newParent - The directory the node should be moved to.
newName - The new name of the node.
Throws:
IOException - Thrown if an error occurs while the node is being moved or renamed.

setName

public void setName(String name)
             throws IOException
Description copied from interface: Node
Renames the node.

Specified by:
setName in interface Node
Parameters:
name - The new name of the node.
Throws:
IOException - Thrown if an error occurs while renaming the node.

getName

public String getName()
Description copied from interface: Node
Retrieves the name of the node.

Specified by:
getName in interface Node
Returns:

isRoot

public boolean isRoot()

getParent

public Directory getParent()
                    throws FileNotFoundException
Description copied from interface: Node
Retrieves the parent directory of this node.

Specified by:
getParent in interface Node
Returns:
The parent directory.
Throws:
FileNotFoundException - Thrown if parent directory could not be found - would normally only occur if called on the root directory.

getFileSystem

public FileSystem getFileSystem()
Description copied from interface: Node
Retrieves the filesystem which this node belongs to.

Specified by:
getFileSystem in interface Node
Returns:
The filesystem.

isDirectory

public boolean isDirectory()
Description copied from interface: Node
Checks wether this node is a directory.

Specified by:
isDirectory in interface Node
Returns:
True/False wether this node is a directory.

isFile

public boolean isFile()
Description copied from interface: Node
Checks wether this node is a file.

Specified by:
isFile in interface Node
Returns:
True/False wether this node is a file.

isHidden

public boolean isHidden()
Description copied from interface: Node
Checks wether this node is hidden.

Specified by:
isHidden in interface Node
Returns:
True/False if this node is hidden.

getLastModified

public Date getLastModified()
Description copied from interface: Node
Retrieves the date for last modification.

Specified by:
getLastModified in interface Node
Returns:
The date for alst modification.

setLastModified

public void setLastModified(Date date)
Description copied from interface: Node
Sets the date for last modification.

Specified by:
setLastModified in interface Node
Parameters:
date - The date.

compareTo

public int compareTo(Node node)
Description copied from interface: Node
Compare this node to another node by comparing their names.

Specified by:
compareTo in interface Node
Parameters:
node - The node to compare with.
Returns:
The returnvalue of the comparison of the to nodes names.

delete

public void delete()
            throws IOException
Description copied from interface: Node
Deletes the node.

Specified by:
delete in interface Node
Throws:
IOException - Thrown if an error occurs during deletion.

toUri

public URI toUri()
Specified by:
toUri in interface Node

equals

public boolean equals(Node node)
Specified by:
equals in interface Node

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(Object arg0)
Specified by:
compareTo in interface Comparable

getPath

public Path getPath()
Specified by:
getPath in interface Node

canRead

public boolean canRead()
Description copied from interface: Node
Retrieves information about wether access to read is allowed. It should also check via the native filesystem if possible.

Specified by:
canRead in interface Node
Returns:
True/False

canWrite

public boolean canWrite()
Description copied from interface: Node
Retrieves information about wether access to read is allowed. It should also check via the native filesystem if possible.

Specified by:
canWrite in interface Node
Returns:
True/False

getBaseName

public String getBaseName()
Description copied from interface: Node
Retrieves the name without suffix like this: myimage.jpg = myimage mybundle.app = mybundle testfile.dit.dat = testfile.dit testdir = testdir

Specified by:
getBaseName in interface Node
Returns:
The nodes basename.

getSuffix

public String getSuffix()
Description copied from interface: Node
Retrieves the suffix of the node or null if no suffix, like this:. myimage.jpg = jpg mybundle.app = app testfile.dit.dat = dat testdir =

Specified by:
getSuffix in interface Node
Returns:
The suffix or null.


Copyright © 2011. All Rights Reserved.