com.sas.io
Class FileSystem

com.sas.io.FileSystem
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, ComponentInterface, LinkPropertiesInterface, ModelInterface, NodeIconInterface, NodeInterface, SimpleNodeInterface, com.sas.PublicClonable, ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class FileSystem
implements NodeIconInterface, com.sas.PublicClonable

A class representing File System on local machine. Based on the name of the Operating System of the local machine either creates a windows File System or Unix File System (to be added later).

Creating a FileSystem Component

FileSystem a = new FileSystem("d:"); System.out.println("type: " +a.getDeviceType()); System.out.println("FStype: " +a.getFileSystemType());

See Also:
Serialized Form

Field Summary
protected  boolean leafNode
           
protected  java.lang.String nodeExpandedText
           
protected  java.lang.String nodeText
           
protected  java.lang.String nodeType
           
 
Constructor Summary
FileSystem(java.lang.String fileSystemName)
          Creates a FileSystem object given a string based on the operating system being used by the local machine.
 
Method Summary
 void _setNodeExpandedText(java.lang.String expandedText)
          Sets the Name of this FileSystem object.
 void _setNodeText(java.lang.String driveName)
          Sets the Name of this FileSystem object.
 void _setNodeType()
          Sets the type of this FileSystem object.eg. drive, root etc.
 boolean canRead()
          Checks to see if can read the FileSystem.
 boolean canWrite()
          Checks to see if can write to the root directory of this FileSystem.
 java.lang.Object clone()
          Create a copy of the current model
protected  void commonInit(java.lang.String fileSystemName)
          This method creates a fileSystem object based on the operating system.
 int countNodeChildren(int maximumChildCount)
          Counts the children of the current node.
 com.sas.visuals.IconInterface getDefaultIcon()
          Returns the default icon for the current node.
 java.lang.String getDeviceType()
          Gets type of the drive(Rmovable, Fixed, CD_ROM...) for Windows
 java.lang.String getDriveType()
          Deprecated. use getDeviceType()
 com.sas.visuals.IconInterface getExpandedIcon()
          Returns the expanded icon for the current node.
 com.sas.visuals.IconInterface getExpandedSelectedIcon()
          Sets the expandedSelected icon for the current node.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
static com.sas.io.FileSystemPeer getFileSystem()
           
 java.lang.String getFileSystemName()
          Gets a logical name of this File System.
 java.lang.String getFileSystemType()
          Gets a type of this File System FAT or NTFS or NTCOMPAT(network drive)
 SimpleNodeInterface getNodeChild(int index)
          Returns the child node at the specified index.
 int getNodeChildCount()
          Returns the number of children available.
 SimpleNodeInterface[] getNodeChildren(int startIndex, int numCount)
          Returns the children of the current node in the specified range.
 java.lang.String getNodeExpandedText()
          If the expanded text is not set then gets an absolute path name of this object.
 java.lang.String getNodeText()
          Gets the Name of this File System object. eg.
 java.lang.String getNodeType()
          Gets the type of this File System object.
 File getRootDirectory()
          Gets the root directory of this file system
 com.sas.visuals.IconInterface getSelectedIcon()
          Returns the selected icon for the current node.
 boolean isLeafNode()
          Returns true if this object does not have children and thus is not expandable.
 boolean isValid()
          Checks to see if the root directory of this File System exists.
static void setErrorMode()
           
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getRequiredInterfaces, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 

Field Detail

nodeText

protected transient java.lang.String nodeText

nodeExpandedText

protected transient java.lang.String nodeExpandedText

nodeType

protected transient java.lang.String nodeType

leafNode

protected transient boolean leafNode
Constructor Detail

FileSystem

public FileSystem(java.lang.String fileSystemName)
Creates a FileSystem object given a string based on the operating system being used by the local machine. Throws a security exeption if cannot access the operating system name.

Parameters:
fileSystemName - logical name of the File System.
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

getFileSystem

public static com.sas.io.FileSystemPeer getFileSystem()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a copy of the current model

Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class Component
Returns:
a clone of the object.
Throws:
java.lang.CloneNotSupportedException - if the model attached to the component being cloned will not allow the clone to attach.

commonInit

protected void commonInit(java.lang.String fileSystemName)
This method creates a fileSystem object based on the operating system. Currently implemented for the Windows os.

Parameters:
fileSystemName - name of the file system eg. a:, c:...
Throws:
java.lang.SecurityException - if cannot access the name of the operating system.

canRead

public boolean canRead()
Checks to see if can read the FileSystem.

Returns:
boolean true if can read the root directory of this drive, false otherwise.

canWrite

public boolean canWrite()
Checks to see if can write to the root directory of this FileSystem.

Returns:
boolean true if can write, false otherwise.

getNodeChildren

public SimpleNodeInterface[] getNodeChildren(int startIndex,
                                             int numCount)
Returns the children of the current node in the specified range. SimpleNodeInterface implementation

Specified by:
getNodeChildren in interface SimpleNodeInterface
Parameters:
startIndex - index which identifies the start of the range
count - number of children to return
Returns:
an array containing the specified range of children or null if the leafNode property value is true.

getNodeChild

public SimpleNodeInterface getNodeChild(int index)
Returns the child node at the specified index. SimpleNodeInterface implementation

Specified by:
getNodeChild in interface SimpleNodeInterface
Parameters:
index - the index of the child node to retrieve
Returns:
the child at index or null if the leafNode property value is true.

getNodeChildCount

public int getNodeChildCount()
Returns the number of children available.

Specified by:
getNodeChildCount in interface SimpleNodeInterface
Returns:
the number of children or -1 if unknown

countNodeChildren

public int countNodeChildren(int maximumChildCount)
Counts the children of the current node. The result of getNodeChildCount() is returned from this method, ignoring maximumChildCount.

Specified by:
countNodeChildren in interface SimpleNodeInterface
Parameters:
maximumChildCount - the maximum number of children to read, or 0 to read indefinitely
Returns:
The number of children known to be available.

getDriveType

public java.lang.String getDriveType()
Deprecated. use getDeviceType()

Gets type of the drive(Rmovable, Fixed, CD_ROM...) for Windows

Returns:
String specifying type

getDeviceType

public java.lang.String getDeviceType()
Gets type of the drive(Rmovable, Fixed, CD_ROM...) for Windows

Returns:
String specifying type

getNodeExpandedText

public java.lang.String getNodeExpandedText()
If the expanded text is not set then gets an absolute path name of this object. SimpleNodeInterface implementation

Specified by:
getNodeExpandedText in interface NodeInterface
Returns:
String absolute path.

getFileSystemName

public java.lang.String getFileSystemName()
Gets a logical name of this File System.

Returns:
String logical name of the drive. eg. a:, c:

getFileSystemType

public java.lang.String getFileSystemType()
Gets a type of this File System FAT or NTFS or NTCOMPAT(network drive)

Returns:
String type of the FileSystem.

getNodeType

public java.lang.String getNodeType()
Gets the type of this File System object. Currently, it is used by Treeview and returns either drive, root etc.

Specified by:
getNodeType in interface NodeInterface
Returns:
String File type-directory, drive or file.

getRootDirectory

public File getRootDirectory()
Gets the root directory of this file system

Returns:
File root directory of this file system

getNodeText

public java.lang.String getNodeText()
Gets the Name of this File System object. eg. Name of a drive.

Specified by:
getNodeText in interface NodeInterface
Returns:
String name of the drive.

setErrorMode

public static void setErrorMode()

isLeafNode

public boolean isLeafNode()
Returns true if this object does not have children and thus is not expandable. SimpleNodeInterface implementation

Specified by:
isLeafNode in interface SimpleNodeInterface
Returns:
boolean True if has no children, False otherwise.

isValid

public boolean isValid()
Checks to see if the root directory of this File System exists.

Returns:
true if fileSystem exists, false otherwise.

_setNodeExpandedText

public void _setNodeExpandedText(java.lang.String expandedText)
Sets the Name of this FileSystem object.

Parameters:
expandedText - full name of the drive.

_setNodeType

public void _setNodeType()
Sets the type of this FileSystem object.eg. drive, root etc.


_setNodeText

public void _setNodeText(java.lang.String driveName)
Sets the Name of this FileSystem object.

Parameters:
driveName - name of the drive.

getDefaultIcon

public com.sas.visuals.IconInterface getDefaultIcon()
Returns the default icon for the current node.

Specified by:
getDefaultIcon in interface NodeIconInterface
Returns:
the default icon for the current node

getExpandedIcon

public com.sas.visuals.IconInterface getExpandedIcon()
Returns the expanded icon for the current node. If the expanded icon is null then the result of getDefaultIcon should be returned.

Specified by:
getExpandedIcon in interface NodeIconInterface
Returns:
the expanded icon for the current node

getSelectedIcon

public com.sas.visuals.IconInterface getSelectedIcon()
Returns the selected icon for the current node. If the selected icon is null then the result of getDefaultIcon should be returned.

Specified by:
getSelectedIcon in interface NodeIconInterface
Returns:
the selected icon for the current node

getExpandedSelectedIcon

public com.sas.visuals.IconInterface getExpandedSelectedIcon()
Sets the expandedSelected icon for the current node. If the expandedSelected icon is null then the result of getExpandedIcon should be returned.

Specified by:
getExpandedSelectedIcon in interface NodeIconInterface
Returns:
the expandedSelected icon for the current node



Copyright © 2009 SAS Institute Inc. All Rights Reserved.