com.mindtree.techworks.insight.download.ftpbrowse
Class FTPRemoteFileSystemView

java.lang.Object
  extended by javax.swing.filechooser.FileSystemView
      extended by com.mindtree.techworks.insight.download.ftpbrowse.FTPRemoteFileSystemView

public class FTPRemoteFileSystemView
extends javax.swing.filechooser.FileSystemView

This class is used for browsing a remote file system. This class uses an instance of the FTPClientto connect to the underlying FTP Source. Connection timeouts may occur.

Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik
See Also:
FileSystemView

Field Summary
static java.net.PasswordAuthentication anonPassAuth
          Password Authentication to use for anonymous access
static java.lang.String FILE_SEPERATOR
          Seperator character between files
protected static java.lang.String FILE_SYSTEM_ROOT_NAME
          The root file system path
protected static java.util.logging.Logger logger
          The logger instance for this class
 
Constructor Summary
FTPRemoteFileSystemView(java.lang.String host, int port, java.net.PasswordAuthentication passwordAuthentication)
          Creates an instance of the FTPRemoteFileSystemView.
FTPRemoteFileSystemView(java.lang.String host, java.net.PasswordAuthentication passwordAuthentication)
          Creates an instance of the FTPRemoteFileSystemView.
FTPRemoteFileSystemView(java.net.URL url, java.net.PasswordAuthentication passwordAuthentication)
          Creates a new instance of the FTP Remote File System View.
 
Method Summary
 java.io.File createFileObject(java.io.File dir, java.lang.String filename)
           
 java.io.File createFileObject(java.lang.String path)
           
 java.io.File createNewFolder(java.io.File containingDir)
           
 void disconnect()
          If a connection to the server is still open, disconnects it.
 java.io.File getChild(java.io.File parent, java.lang.String fileName)
           
 java.io.File getDefaultDirectory()
          In the remote view home and default directory are considered to be the same.
 java.io.File[] getFiles(java.io.File dir, boolean useFileHiding)
           
 java.io.File getHomeDirectory()
           
 java.io.File getParentDirectory(java.io.File dir)
           
 java.net.PasswordAuthentication getPasswordAuthentication()
           
 java.io.File[] getRoots()
           
 java.lang.String getSystemDisplayName(java.io.File f)
           
 java.lang.String getSystemTypeDescription(java.io.File f)
          Always returns null.
 java.net.URL getUrl()
           
 boolean isComputerNode(java.io.File dir)
           
 boolean isDrive(java.io.File dir)
          Returns false, drives not supported on remote systems
 boolean isFileSystem(java.io.File f)
          Determines if the file is a real file or a link to another file.
 boolean isFileSystemRoot(java.io.File dir)
           
 boolean isFloppyDrive(java.io.File dir)
          Returns false.
 boolean isHiddenFile(java.io.File f)
          Hidden files are not supported now.
 boolean isParent(java.io.File folder, java.io.File file)
           
 boolean isRoot(java.io.File f)
           
 java.lang.Boolean isTraversable(java.io.File f)
           
 
Methods inherited from class javax.swing.filechooser.FileSystemView
createFileSystemRoot, getFileSystemView, getSystemIcon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final java.util.logging.Logger logger
The logger instance for this class


anonPassAuth

public static final java.net.PasswordAuthentication anonPassAuth
Password Authentication to use for anonymous access


FILE_SYSTEM_ROOT_NAME

protected static final java.lang.String FILE_SYSTEM_ROOT_NAME
The root file system path

See Also:
Constant Field Values

FILE_SEPERATOR

public static final java.lang.String FILE_SEPERATOR
Seperator character between files

See Also:
Constant Field Values
Constructor Detail

FTPRemoteFileSystemView

public FTPRemoteFileSystemView(java.net.URL url,
                               java.net.PasswordAuthentication passwordAuthentication)
Creates a new instance of the FTP Remote File System View.

Parameters:
url -
passwordAuthentication -

FTPRemoteFileSystemView

public FTPRemoteFileSystemView(java.lang.String host,
                               int port,
                               java.net.PasswordAuthentication passwordAuthentication)
                        throws FTPBrowseException
Creates an instance of the FTPRemoteFileSystemView. The host name supplied should be the same as one would pass to construct an URL object.

Parameters:
host - The address of the host. This can be a host name or IP address.
port - The port to connect to.
passwordAuthentication - The credentials to connect with. This can be null.
Throws:
FTPBrowseException - If a URL cannot be formed with the values.
See Also:
URL

FTPRemoteFileSystemView

public FTPRemoteFileSystemView(java.lang.String host,
                               java.net.PasswordAuthentication passwordAuthentication)
                        throws FTPBrowseException
Creates an instance of the FTPRemoteFileSystemView. The host name supplied should be the same as one would pass to construct an URL object.

Parameters:
host - The address of the host. This can be a host name or IP address.
passwordAuthentication - The credentials to use to connect. Can be null.
Throws:
FTPBrowseException - If a URL cannot be formed with the values.
See Also:
URL
Method Detail

getPasswordAuthentication

public java.net.PasswordAuthentication getPasswordAuthentication()
Returns:
Returns the passwordAuthentication.

getUrl

public java.net.URL getUrl()
Returns:
Returns the url.

disconnect

public void disconnect()
If a connection to the server is still open, disconnects it.


createNewFolder

public java.io.File createNewFolder(java.io.File containingDir)
                             throws java.io.IOException
Specified by:
createNewFolder in class javax.swing.filechooser.FileSystemView
Throws:
java.io.IOException
See Also:
FileSystemView.createNewFolder(java.io.File)

getDefaultDirectory

public java.io.File getDefaultDirectory()
In the remote view home and default directory are considered to be the same.

Overrides:
getDefaultDirectory in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getDefaultDirectory()

getHomeDirectory

public java.io.File getHomeDirectory()
Overrides:
getHomeDirectory in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getHomeDirectory()

getRoots

public java.io.File[] getRoots()
Overrides:
getRoots in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getRoots()

createFileObject

public java.io.File createFileObject(java.io.File dir,
                                     java.lang.String filename)
Overrides:
createFileObject in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.createFileObject(java.io.File, java.lang.String)

createFileObject

public java.io.File createFileObject(java.lang.String path)
Overrides:
createFileObject in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.createFileObject(java.lang.String)

getChild

public java.io.File getChild(java.io.File parent,
                             java.lang.String fileName)
Overrides:
getChild in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getChild(java.io.File, java.lang.String)

getFiles

public java.io.File[] getFiles(java.io.File dir,
                               boolean useFileHiding)
Overrides:
getFiles in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getFiles(java.io.File, boolean)

getParentDirectory

public java.io.File getParentDirectory(java.io.File dir)
Overrides:
getParentDirectory in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getParentDirectory(java.io.File)

getSystemDisplayName

public java.lang.String getSystemDisplayName(java.io.File f)
Overrides:
getSystemDisplayName in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getSystemDisplayName(java.io.File)

getSystemTypeDescription

public java.lang.String getSystemTypeDescription(java.io.File f)
Always returns null. The super class uses this to return special folder names such as 'Desktop' on Windows.

Overrides:
getSystemTypeDescription in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.getSystemTypeDescription(java.io.File)

isComputerNode

public boolean isComputerNode(java.io.File dir)
Overrides:
isComputerNode in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isComputerNode(java.io.File)

isDrive

public boolean isDrive(java.io.File dir)
Returns false, drives not supported on remote systems

Overrides:
isDrive in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isDrive(java.io.File)

isFileSystem

public boolean isFileSystem(java.io.File f)
Determines if the file is a real file or a link to another file.

Overrides:
isFileSystem in class javax.swing.filechooser.FileSystemView
Returns:
true if it is an absolute file or false
See Also:
FileSystemView.isFileSystem(java.io.File)

isFileSystemRoot

public boolean isFileSystemRoot(java.io.File dir)
Overrides:
isFileSystemRoot in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isFileSystemRoot(java.io.File)

isFloppyDrive

public boolean isFloppyDrive(java.io.File dir)
Returns false. No floppy drives are viewable.

Overrides:
isFloppyDrive in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isFloppyDrive(java.io.File)

isHiddenFile

public boolean isHiddenFile(java.io.File f)
Hidden files are not supported now. Maybe later!

Overrides:
isHiddenFile in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isHiddenFile(java.io.File)

isParent

public boolean isParent(java.io.File folder,
                        java.io.File file)
Overrides:
isParent in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isParent(java.io.File, java.io.File)

isRoot

public boolean isRoot(java.io.File f)
Overrides:
isRoot in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isRoot(java.io.File)

isTraversable

public java.lang.Boolean isTraversable(java.io.File f)
Overrides:
isTraversable in class javax.swing.filechooser.FileSystemView
See Also:
FileSystemView.isTraversable(java.io.File)


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.