Remote Systems
v6.4.1

com.ibm.etools.systems.universalfilesubsys.impl
Class UniversalFileImpl

java.lang.Object
  extended bycom.ibm.etools.systems.subsystems.impl.RemoteFileImpl
      extended bycom.ibm.etools.systems.universalfilesubsys.impl.UniversalFileImpl
All Implemented Interfaces:
Cloneable, Comparable, IAdaptable, IRemoteContainer, IRemoteFile, IRemoteFileMutable, IRemotePropertyHolder, ISystemContainer, IUniversalDataStoreConstants

public class UniversalFileImpl
extends RemoteFileImpl
implements IRemoteFile, IUniversalDataStoreConstants

Represents a hierarchical file object in any windows or unix like hierarchical file system


Nested Class Summary
 class UniversalFileImpl.AttributesListener
           
 class UniversalFileImpl.CanWriteListener
           
 class UniversalFileImpl.StatusListener
           
 
Field Summary
protected  boolean attcanWriteRetrieved
           
protected  boolean attClassificationRetrieved
           
protected  boolean attrsRetrieved
           
protected  String comment
           
protected  long compressedSize
           
protected  String compressionMethod
           
protected  double compressionRatio
           
static String copyright
           
protected  boolean existsRetrieved
           
protected  long expandedSize
           
protected  boolean isBeingUpdated
           
protected  char sep
           
 
Fields inherited from class com.ibm.etools.systems.subsystems.impl.RemoteFileImpl
_isStale, BINARY_FALSE, BINARY_TRUE, cacheAbsolutePath, canonicalPath, canRead, canWrite, classification, containingArchiveFullName, contents, context, debugMode, DIRECTORY_FALSE, DIRECTORY_TRUE, exists, fullyQualifiedName, isCached, isContainer, isDirectory, isHidden, isRoot, isVirtualFile, isVirtualFolder, label, lastModified, length, nameOnly, parentFile, pathOnly, properties, propertyStates, remoteObj, ROOT_FALSE, ROOT_TRUE, rootOnly, showReadOnly
 
Fields inherited from interface com.ibm.etools.systems.subsystems.IRemoteFile
CONNECTION_DELIMITER, ISROOT_NO, ISROOT_YES
 
Fields inherited from interface com.ibm.etools.systems.universal.miners.IUniversalDataStoreConstants
BINARY_MODE, BUFFER_SIZE, C_DOWNLOAD_FILE, C_QUERY_QUALIFIED_CLASSNAME, C_QUERY_UNUSED_PORT, C_SYSTEM_ENCODING, Copyright, DOWNLOAD_RESULT_EXCEPTION, DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION, DOWNLOAD_RESULT_IO_EXCEPTION, DOWNLOAD_RESULT_SUCCESS_MESSAGE, DOWNLOAD_RESULT_SUCCESS_TYPE, DOWNLOAD_RESULT_UNEXPECTED_ERROR, DOWNLOAD_RESULT_UNSUPPORTED_ENCODING_EXCEPTION, FAILED, FAILED_TO_DELETE_DIR, FAILED_WITH_DOES_NOT_EXIST, FAILED_WITH_EXCEPTION, FAILED_WITH_EXIST, FAILED_WITH_SECURITY, KB_IN_BYTES, MESSAGE_DESCRIPTOR, NUM_OF_KB, SUCCESS, TEXT_MODE, TOKEN_SEPARATOR, TYPE_QUALIFIED_CLASSNAME, UNEXPECTED_ERROR, UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR, UNIVERSAL_FILE_DESCRIPTOR, UNIVERSAL_FILESYSTEM_MINER, UNIVERSAL_FILTER_DESCRIPTOR, UNIVERSAL_FOLDER_DESCRIPTOR, UNIVERSAL_NODE_DESCRIPTOR, UNIVERSAL_TEMP_DESCRIPTOR, UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR, UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR, VERSION_1
 
Constructor Summary
UniversalFileImpl(IRemoteFileContext context, DataElement dataElementObj, boolean isRoot)
          Constructor.
UniversalFileImpl(IRemoteFileContext context, DataElement dataElementObj, boolean isRoot, boolean exists)
          Constructor.
UniversalFileImpl(IRemoteFileContext context, DataElement dataElementObj, boolean isRoot, boolean exists, boolean isDir)
          Constructor.
 
Method Summary
 boolean canRead()
          Returns true if the application can read this file.
 boolean canWrite()
          Returns true if the application can write to this file.
 int compareTo(Object other)
          Compare one remote file to another.
 void dispose()
           
 Object getAdapter(Class key)
          This is the method required by the IAdaptable interface.
protected  void getAttributes()
          The Properties of the file/folder is returned from the miner in a StringTokenizer.
protected  void getcanWrite()
           
 String getClassification()
          Returns the classification of this file.
 String getComment()
           
 long getCompressedSize()
           
 String getCompressionMethod()
           
 double getCompressionRatio()
           
 long getExpandedSize()
           
 String getLabel()
          Get the display name for this file.
 long getLastModified()
          Returns the time (in milliseconds since epoch) this file was last modified.
 Date getLastModifiedDate()
          Return the last modified time as a Date object.
 long getLength()
          Returns the length, in bytes, of this file.
 String getName()
          Get unqualified file name.
 String getParent()
          Get fully qualified path and name of folder containing this file or folder.
 String getParentName()
          Get the unqualified name of the parent directory containing this file or folder.
 String getParentNoRoot()
          Get fully qualified path and name of folder containing this file or folder, minus the root.
 String getRoot()
          Get the root part of the name.
protected  String getRootPart(String s)
          Get the rootPart - this is system dependent.
protected  void init(IRemoteFileContext context, DataElement dataElementObj, boolean isRoot, boolean exists, boolean isDir)
          Initialization.
protected  boolean internalExists(DataElement deObj)
           
 boolean isBeingUpdated()
           
static boolean isDataElementDirectory(DataElement deObj)
           
 boolean isHidden()
          Returns true if this is a hidden file.
 boolean isRoot()
          Returns true if this represents a root folder (eg: c:\\ or /).
 boolean isStale()
          Indicates whether the cached object is stale
 void markStale(boolean isStale)
          Get the DataElement for this object
protected  boolean nameIsRoot(String name)
           
 void setFile(Object dataElementObj)
          Set the DataElement for this object
 void setIsBeingUpdated(boolean flag)
           
 void setIsDirectory(boolean flag)
          Explicitly indicate whether this is a directory or not.
 
Methods inherited from class com.ibm.etools.systems.subsystems.impl.RemoteFileImpl
clearCache, containsFilterKey, copyContentsTo, exists, getAbsolutePath, getAbsolutePathPlusConnection, getAllFilterStrings, getCachedCopy, getCanonicalPath, getContainingArchiveFullName, getContents, getContents, getContext, getExtension, getFile, getFileWrapper, getFilterString, getLineSeparator, getLocalAbsolutePath, getParentRemoteFile, getParentRemoteFileSubSystem, getParentRemoteFileSubSystemFactory, getProperties, getProperty, getSeparator, getSeparatorChar, getSystemConnection, hasContents, hasContents, isAncestorOf, isArchive, isBinary, isDescendantOf, isDirectory, isExecutable, isFile, isLink, isLocal, isPropertyStale, isText, isUnix, isVirtual, isVirtualFile, isVirtualFolder, markAllPropertiesStale, markPropertyStale, replaceContent, setAbsolutePath, setCanRead, setCanWrite, setClassification, setContainingArchiveFullName, setContents, setExists, setFilterString, setIsContainer, setIsHidden, setIsLocal, setLabel, setLastModified, setLength, setLocalAbsolutePath, setName, setNameOnly, setParentRemoteFile, setProperties, setProperty, setVirtualFile, setVirtualFolder, showBriefPropertySet, showReadOnlyProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ibm.etools.systems.subsystems.IRemoteFile
exists, getAbsolutePath, getAbsolutePathPlusConnection, getAllFilterStrings, getCanonicalPath, getExtension, getFile, getFileWrapper, getFilterString, getLineSeparator, getParentRemoteFile, getParentRemoteFileSubSystem, getSeparator, getSeparatorChar, getSystemConnection, isAncestorOf, isArchive, isBinary, isDescendantOf, isDirectory, isExecutable, isFile, isLink, isText, isVirtual, setFilterString, showBriefPropertySet, showReadOnlyProperty
 
Methods inherited from interface com.ibm.etools.systems.subsystems.IRemoteContainer
copyContentsTo, getContents, hasContents, replaceContent, setContents
 
Methods inherited from interface com.ibm.etools.systems.model.ISystemContainer
getContents, hasContents
 
Methods inherited from interface com.ibm.etools.systems.subsystems.IRemotePropertyHolder
getProperties, getProperty, isPropertyStale, markAllPropertiesStale, markPropertyStale, setProperties, setProperty
 

Field Detail

copyright

public static final String copyright
See Also:
Constant Field Values

attrsRetrieved

protected boolean attrsRetrieved

attClassificationRetrieved

protected boolean attClassificationRetrieved

existsRetrieved

protected boolean existsRetrieved

attcanWriteRetrieved

protected boolean attcanWriteRetrieved

isBeingUpdated

protected boolean isBeingUpdated

sep

protected char sep

comment

protected String comment

compressedSize

protected long compressedSize

compressionMethod

protected String compressionMethod

compressionRatio

protected double compressionRatio

expandedSize

protected long expandedSize
Constructor Detail

UniversalFileImpl

public UniversalFileImpl(IRemoteFileContext context,
                         DataElement dataElementObj,
                         boolean isRoot)
Constructor. Mimimalist, when all we know is whether this is a root or not


UniversalFileImpl

public UniversalFileImpl(IRemoteFileContext context,
                         DataElement dataElementObj,
                         boolean isRoot,
                         boolean exists)
Constructor. When we also know if this is exists or not


UniversalFileImpl

public UniversalFileImpl(IRemoteFileContext context,
                         DataElement dataElementObj,
                         boolean isRoot,
                         boolean exists,
                         boolean isDir)
Constructor. When we also know if this is a directory or not

Method Detail

isBeingUpdated

public boolean isBeingUpdated()

setIsBeingUpdated

public void setIsBeingUpdated(boolean flag)

init

protected void init(IRemoteFileContext context,
                    DataElement dataElementObj,
                    boolean isRoot,
                    boolean exists,
                    boolean isDir)
Initialization. For abstraction of common stuff for the various ctors.


nameIsRoot

protected boolean nameIsRoot(String name)

isDataElementDirectory

public static boolean isDataElementDirectory(DataElement deObj)

internalExists

protected boolean internalExists(DataElement deObj)

getRootPart

protected String getRootPart(String s)
Get the rootPart - this is system dependent. For Linux/Unix - it is "/"


setFile

public void setFile(Object dataElementObj)
Set the DataElement for this object

Specified by:
setFile in interface IRemoteFileMutable
Overrides:
setFile in class RemoteFileImpl

setIsDirectory

public void setIsDirectory(boolean flag)
Explicitly indicate whether this is a directory or not.


markStale

public void markStale(boolean isStale)
Get the DataElement for this object

Specified by:
markStale in interface ISystemContainer
Overrides:
markStale in class RemoteFileImpl
See Also:
ISystemContainer.markStale(boolean)

getAttributes

protected void getAttributes()
The Properties of the file/folder is returned from the miner in a StringTokenizer.

The StringTokenizer contains properties of the object in the following order


getcanWrite

protected void getcanWrite()

isHidden

public boolean isHidden()
Returns true if this is a hidden file.

Specified by:
isHidden in interface IRemoteFile
Overrides:
isHidden in class RemoteFileImpl

canRead

public boolean canRead()
Returns true if the application can read this file.

Specified by:
canRead in interface IRemoteFile
Overrides:
canRead in class RemoteFileImpl

canWrite

public boolean canWrite()
Returns true if the application can write to this file.

Specified by:
canWrite in interface IRemoteFile
Overrides:
canWrite in class RemoteFileImpl

getLastModifiedDate

public Date getLastModifiedDate()
Description copied from interface: IRemoteFile
Return the last modified time as a Date object.

Specified by:
getLastModifiedDate in interface IRemoteFile
Overrides:
getLastModifiedDate in class RemoteFileImpl
See Also:
IRemoteFile.getLastModifiedDate()

getLastModified

public long getLastModified()
Description copied from interface: IRemoteFile
Returns the time (in milliseconds since epoch) this file was last modified.

Specified by:
getLastModified in interface IRemoteFile
Overrides:
getLastModified in class RemoteFileImpl
See Also:
IRemoteFile.getLastModified()

getLength

public long getLength()
Description copied from interface: IRemoteFile
Returns the length, in bytes, of this file.

Specified by:
getLength in interface IRemoteFile
Overrides:
getLength in class RemoteFileImpl
See Also:
IRemoteFile.getLength()

getAdapter

public Object getAdapter(Class key)
Description copied from class: RemoteFileImpl
This is the method required by the IAdaptable interface. Given an adapter class type, return an object castable to the type, or null if this is not possible.

By default this returns Platform.getAdapterManager().getAdapter(this, adapterType); This in turn results in the default subsystem adapter SystemViewSubSystemAdapter, in package com.ibm.etools.systems.core.ui.view.

Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class RemoteFileImpl

dispose

public void dispose()

getComment

public String getComment()
Specified by:
getComment in interface IRemoteFile
Overrides:
getComment in class RemoteFileImpl

getCompressedSize

public long getCompressedSize()
Specified by:
getCompressedSize in interface IRemoteFile
Overrides:
getCompressedSize in class RemoteFileImpl

getCompressionMethod

public String getCompressionMethod()
Specified by:
getCompressionMethod in interface IRemoteFile
Overrides:
getCompressionMethod in class RemoteFileImpl

getCompressionRatio

public double getCompressionRatio()
Specified by:
getCompressionRatio in interface IRemoteFile
Overrides:
getCompressionRatio in class RemoteFileImpl

getClassification

public String getClassification()
Description copied from interface: IRemoteFile
Returns the classification of this file. If the file is an executable, then "executable(...)" will be returned. If the file is a symbolic link then it will appear as "link(....):resolvedPath". The resolvedPath is the path that the link resolves to. A symbolic link that resolves to an executable would appear as "link(executable(...)):resolvedPath". By default this should just return "file".

Specified by:
getClassification in interface IRemoteFile
Overrides:
getClassification in class RemoteFileImpl

getExpandedSize

public long getExpandedSize()
Specified by:
getExpandedSize in interface IRemoteFile
Overrides:
getExpandedSize in class RemoteFileImpl

getName

public String getName()
Description copied from interface: IRemoteFile
Get unqualified file name. No root and no path. If this object represents only a root drive, this is the same as getRoot().

Specified by:
getName in interface IRemoteFile
Overrides:
getName in class RemoteFileImpl
See Also:
IRemoteFile.getName()

getLabel

public String getLabel()
Description copied from interface: IRemoteFile
Get the display name for this file. By default, this should be the same as the name If this object represents only a root drive, this is the same as getRoot().

Specified by:
getLabel in interface IRemoteFile
Overrides:
getLabel in class RemoteFileImpl
See Also:
IRemoteFile.getLabel()

getRoot

public String getRoot()
Description copied from interface: IRemoteFile
Get the root part of the name.

Specified by:
getRoot in interface IRemoteFile
Overrides:
getRoot in class RemoteFileImpl
See Also:
IRemoteFile.getRoot()

isRoot

public boolean isRoot()
Description copied from interface: IRemoteFile
Returns true if this represents a root folder (eg: c:\\ or /).

Specified by:
isRoot in interface IRemoteFile
Overrides:
isRoot in class RemoteFileImpl
See Also:
IRemoteFile.isRoot()

compareTo

public int compareTo(Object other)
              throws ClassCastException
Description copied from interface: IRemoteFile
Compare one remote file to another. This enables us to sort the files so they are shown folders-first, and in alphabetical order.

Specified by:
compareTo in interface IRemoteFile
Overrides:
compareTo in class RemoteFileImpl
Throws:
ClassCastException

getParent

public String getParent()
Description copied from interface: IRemoteFile
Get fully qualified path and name of folder containing this file or folder. Returns the root and path. No file name, and no ending separator.

If this object represent only a root drive, this returns null;

Example: c:\folder1\folder2\file1.ext results in c:\folder1\folder2

Specified by:
getParent in interface IRemoteFile
Overrides:
getParent in class RemoteFileImpl
See Also:
IRemoteFile.getParent()

getParentName

public String getParentName()
Description copied from interface: IRemoteFile
Get the unqualified name of the parent directory containing this file or folder. Compare this to getParent() that returns the fully qualified parent directory. If this object represents only a root drive, this returns null.

Example: c:\folder1\folder2\file1.ext results in folder2

Specified by:
getParentName in interface IRemoteFile
Overrides:
getParentName in class RemoteFileImpl
See Also:
IRemoteFile.getParentName()

getParentNoRoot

public String getParentNoRoot()
Description copied from interface: IRemoteFile
Get fully qualified path and name of folder containing this file or folder, minus the root. Returns the path. No root prefix. No file name, and no ending separator.

If this object represent only a root drive, this returns null;

Example: c:\folder1\folder2\file1.ext results in folder1\folder2

Specified by:
getParentNoRoot in interface IRemoteFile
Overrides:
getParentNoRoot in class RemoteFileImpl
See Also:
IRemoteFile.getParentNoRoot()

isStale

public boolean isStale()
Description copied from interface: ISystemContainer
Indicates whether the cached object is stale

Specified by:
isStale in interface ISystemContainer
Overrides:
isStale in class RemoteFileImpl
See Also:
ISystemContainer.isStale()

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.