Remote Systems
v6.4.1

com.ibm.etools.systems.universal.miners
Class UniversalFileSystemMiner

java.lang.Object
  extended bycom.ibm.etools.systems.dstore.core.miners.miner.Miner
      extended bycom.ibm.etools.systems.universal.miners.UniversalFileSystemMiner
All Implemented Interfaces:
IClientServerConstants, ISchemaExtender, IUniversalDataStoreConstants

public class UniversalFileSystemMiner
extends Miner
implements IUniversalDataStoreConstants, IClientServerConstants


Field Summary
protected  ArchiveHandlerManager _archiveHandlerManager
           
protected  HashMap _cancellableThreads
           
static String CLASSNAME
           
static String copyright
           
protected  String filterString
           
protected  boolean showHidden
           
 
Fields inherited from class com.ibm.etools.systems.dstore.core.miners.miner.Miner
_dataStore, _dependencies, _minerData, _minerElement, _minerTransient, _name, _resourceBundle, _value, Copyright
 
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
 
Fields inherited from interface com.ibm.etools.systems.core.clientserver.IClientServerConstants
Copyright, FILEMSG_ARCHIVE_CORRUPTED, FILEMSG_COPY_FILE_FAILED, FILEMSG_CREATE_FILE_FAILED, FILEMSG_CREATE_FILE_FAILED_EXIST, FILEMSG_CREATE_FOLDER_FAILED, FILEMSG_CREATE_FOLDER_FAILED_EXIST, FILEMSG_CREATE_RESOURCE_NOTVISIBLE, FILEMSG_DELETE_FILE_FAILED, FILEMSG_ERROR_NOFILETYPES, FILEMSG_MOVE_FILE_FAILED, FILEMSG_MOVE_TARGET_EQUALS_SOURCE, FILEMSG_NO_PERMISSION, FILEMSG_REMOTE_SAVE_FAILED, FILEMSG_RENAME_FILE_FAILED, FILEMSG_RENAME_RESOURCE_NOTVISIBLE, INCLUDE_ALL, INCLUDE_FILES_ONLY, INCLUDE_FOLDERS_ONLY, MSG_EXCEPTION_DELETING, MSG_EXCEPTION_MOVING, MSG_EXCEPTION_OCCURRED, MSG_EXCEPTION_RENAMING, MSG_PREFIX, PLUGIN_ID, PREFIX, RESID_PREFIX
 
Constructor Summary
UniversalFileSystemMiner()
           
 
Method Summary
protected  void createDataElement(DataStore ds, DataElement subject, File[] list, String queryType, String filter, int include)
           
protected  void createDataElement(DataStore ds, DataElement subject, File[] list, String queryType, String filter, int include, String[] types)
          Method to create the DataElement object in the datastore.
protected  void createDataElement(DataStore ds, DataElement subject, VirtualChild[] list, String filter, String rootPath, String virtualPath)
          Method to create the DataElement object in the datastore out of a list of VirtualChildren
 void deleteDir(File fileObj, DataElement status)
          Delete directory and its children.
 void extendSchema(DataElement schemaRoot)
          Add this tool's schema to the global DataStore schema.
 void finish()
          Shuts down the miner and cleans up it's meta-information.
 AbsoluteVirtualPath getAbsoluteVirtualPath(String path)
           
 ISystemArchiveHandler getArchiveHandlerFor(String archivePath)
           
protected  String getClassificationString(String s)
          Method to obtain the classificatoin string of file or folder.
protected  int getDepth(String s)
          Method to obtain the depth for a search
protected  FileClassifier getFileClassifier(DataElement subject)
           
protected  DataElement getFileElement(DataElement subject, File file)
           
protected  String getFilterString(String s)
          Method to obtain the filter string of file or folder.
protected  InputStream getInputStreamForFile(String filename)
           
protected  boolean getShowHiddenFlag(String s)
          Method to obtain the show Hidden flag for file or folder.
 String getVersion()
          Returns the version of this miner The expected format for this is ".
 DataElement handleCancel(DataElement subject, DataElement status)
           
 DataElement handleCommand(DataElement theElement)
          Handle commands that are routed to this miner.
 DataElement handleCopy(DataElement targetFolder, DataElement sourceFile, DataElement nameObj, DataElement status)
           
 DataElement handleCreateFile(DataElement subject, DataElement status, String queryType)
          Method to create a new file.
 DataElement handleCreateFolder(DataElement subject, DataElement status, String queryType)
          Method to create a new folder.
 DataElement handleCreateVirtualFile(DataElement subject, DataElement status, String type)
           
 DataElement handleCreateVirtualFolder(DataElement subject, DataElement status, String type)
           
 DataElement handleDelete(DataElement subject, DataElement status)
          Method to Delete a file or folder.
 DataElement handleDeleteFromArchive(DataElement subject, DataElement status)
           
protected  DataElement handleDownload(DataElement theElement, DataElement status)
          Method to download a file.
 DataElement handleGetOSType(DataElement subject, DataElement status)
          Method to retrieve the OS that the miner is running.
protected  DataElement handleQueryAdvanceProperty(DataElement subject, DataElement status)
          Method to query advance properties.
 DataElement handleQueryAll(DataElement subject, DataElement attributes, DataElement status, String queryType, boolean caseSensitive)
          Method to list the files and folders for a given filter.
 DataElement handleQueryAllArchive(DataElement subject, DataElement attributes, DataElement status, boolean caseSensitive, boolean foldersOnly)
           
protected  DataElement handleQueryBasicProperty(DataElement subject, DataElement status)
          Method to Retrieve properties of the file or folder.
protected  DataElement handleQuerycanWriteProperty(DataElement subject, DataElement status)
          Method to Retrieve canWrite property of the file or folder.
protected  DataElement handleQueryClassName(DataElement subject, DataElement status)
          Retrieve the fully qualified class name (including package) for the specified .class file.
protected  DataElement handleQueryEncoding(DataElement subject, DataElement status)
          Get the system encoding
protected  DataElement handleQueryExists(DataElement subject, DataElement status, String queryType)
          Method to query existence of the file or folder.
protected  DataElement handleQueryFileClassification(DataElement subject, DataElement status)
           
 DataElement handleQueryFiles(DataElement subject, DataElement attributes, DataElement status, String queryType, boolean caseSensitive)
          Method to list the files for a given filter.
 DataElement handleQueryFolders(DataElement subject, DataElement attributes, DataElement status, String queryType, boolean caseSensitive)
          Method to list the folders for a given filter.
 DataElement handleQueryGetRemoteObject(DataElement subject, DataElement status, String queryType)
          Method to get remote object
protected  DataElement handleQueryQualifiedClassName(DataElement subject, DataElement status)
          Retrieve the fully qualified class name (including package) for a class file.
 DataElement handleQueryRoots(DataElement subject, DataElement status)
          Method to list the roots.
protected  DataElement handleQueryUnusedPort(DataElement subject, DataElement status)
          Get an unused port number.
 DataElement handleRename(DataElement subject, DataElement status)
          Method to Rename a file or folder.
 DataElement handleSearch(DataElement theElement, DataElement status, String queryType, boolean fileNamesCaseSensitive)
          Method to do a search.
 DataElement handleSetLastModified(DataElement subject, DataElement status)
          Method to set LastModified to a file or folder.
 DataElement handleSetReadOnly(DataElement subject, DataElement status)
          Method to set ReadOnly to a file or folder.
protected  void internalQueryAll(DataElement subject, File fileobj, String queryType, String filter, boolean caseSensitive, int inclusion)
           
protected  boolean isSpecialChar(char c)
          Checks whether the given character is a special character in the shell.
 void load()
          Default method that gets called on a Miner when it is loaded.
 String setProperties(File fileObj)
           
 String setProperties(File fileObj, boolean doArchiveProperties)
          Method to obtain the properties of file or folder.
 String setProperties(VirtualChild fileObj)
           
 DataElement statusCancelled(DataElement status)
          Cancel status.
 DataElement statusDone(DataElement status)
          Complete status.
 
Methods inherited from class com.ibm.etools.systems.dstore.core.miners.miner.Miner
command, createAbstractCommandDescriptor, createAbstractObjectDescriptor, createAbstractObjectDescriptor, createAbstractRelationship, createCommandDescriptor, createCommandDescriptor, createObjectDescriptor, createObjectDescriptor, createReference, createRelationDescriptor, getCommandArgument, getCommandName, getCommandStatus, getDependencies, getExternalLoader, getLocalizedString, getMinerData, getMinerDependencies, getMinerElement, getMinerTransient, getName, getNumberOfCommandArguments, getResourceBundle, getSchemaRoot, getValue, isConnected, isInitialized, load, makeTransient, setDataStore, setExternalLoader, updateMinerInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterString

protected String filterString

_archiveHandlerManager

protected ArchiveHandlerManager _archiveHandlerManager

showHidden

protected boolean showHidden

copyright

public static final String copyright
See Also:
Constant Field Values

CLASSNAME

public static final String CLASSNAME
See Also:
Constant Field Values

_cancellableThreads

protected HashMap _cancellableThreads
Constructor Detail

UniversalFileSystemMiner

public UniversalFileSystemMiner()
Method Detail

getFileClassifier

protected FileClassifier getFileClassifier(DataElement subject)

handleCommand

public DataElement handleCommand(DataElement theElement)
Description copied from class: Miner
Handle commands that are routed to this miner. This interface must be implemented by each miner in order to perform tool actions driven from user interface interaction.

Specified by:
handleCommand in class Miner
Parameters:
theElement - an instance of a command containing a tree of arguments
See Also:
Miner.handleCommand(DataElement)

deleteDir

public void deleteDir(File fileObj,
                      DataElement status)
Delete directory and its children.


handleSearch

public DataElement handleSearch(DataElement theElement,
                                DataElement status,
                                String queryType,
                                boolean fileNamesCaseSensitive)
Method to do a search.


handleCancel

public DataElement handleCancel(DataElement subject,
                                DataElement status)

handleQueryAll

public DataElement handleQueryAll(DataElement subject,
                                  DataElement attributes,
                                  DataElement status,
                                  String queryType,
                                  boolean caseSensitive)
Method to list the files and folders for a given filter.


internalQueryAll

protected void internalQueryAll(DataElement subject,
                                File fileobj,
                                String queryType,
                                String filter,
                                boolean caseSensitive,
                                int inclusion)

handleQueryFiles

public DataElement handleQueryFiles(DataElement subject,
                                    DataElement attributes,
                                    DataElement status,
                                    String queryType,
                                    boolean caseSensitive)
Method to list the files for a given filter.


handleQueryFolders

public DataElement handleQueryFolders(DataElement subject,
                                      DataElement attributes,
                                      DataElement status,
                                      String queryType,
                                      boolean caseSensitive)
Method to list the folders for a given filter.


handleQueryRoots

public DataElement handleQueryRoots(DataElement subject,
                                    DataElement status)
Method to list the roots.


handleDelete

public DataElement handleDelete(DataElement subject,
                                DataElement status)
Method to Delete a file or folder.


handleRename

public DataElement handleRename(DataElement subject,
                                DataElement status)
Method to Rename a file or folder.


handleCreateFile

public DataElement handleCreateFile(DataElement subject,
                                    DataElement status,
                                    String queryType)
Method to create a new file.


handleCreateFolder

public DataElement handleCreateFolder(DataElement subject,
                                      DataElement status,
                                      String queryType)
Method to create a new folder.


handleSetReadOnly

public DataElement handleSetReadOnly(DataElement subject,
                                     DataElement status)
Method to set ReadOnly to a file or folder.


handleSetLastModified

public DataElement handleSetLastModified(DataElement subject,
                                         DataElement status)
Method to set LastModified to a file or folder.


handleQueryBasicProperty

protected DataElement handleQueryBasicProperty(DataElement subject,
                                               DataElement status)
Method to Retrieve properties of the file or folder.


handleQuerycanWriteProperty

protected DataElement handleQuerycanWriteProperty(DataElement subject,
                                                  DataElement status)
Method to Retrieve canWrite property of the file or folder.


handleQueryAdvanceProperty

protected DataElement handleQueryAdvanceProperty(DataElement subject,
                                                 DataElement status)
Method to query advance properties.


handleQueryFileClassification

protected DataElement handleQueryFileClassification(DataElement subject,
                                                    DataElement status)

handleQueryExists

protected DataElement handleQueryExists(DataElement subject,
                                        DataElement status,
                                        String queryType)
Method to query existence of the file or folder.


handleQueryGetRemoteObject

public DataElement handleQueryGetRemoteObject(DataElement subject,
                                              DataElement status,
                                              String queryType)
Method to get remote object


getFileElement

protected DataElement getFileElement(DataElement subject,
                                     File file)

createDataElement

protected void createDataElement(DataStore ds,
                                 DataElement subject,
                                 File[] list,
                                 String queryType,
                                 String filter,
                                 int include)

createDataElement

protected void createDataElement(DataStore ds,
                                 DataElement subject,
                                 File[] list,
                                 String queryType,
                                 String filter,
                                 int include,
                                 String[] types)
Method to create the DataElement object in the datastore.


createDataElement

protected void createDataElement(DataStore ds,
                                 DataElement subject,
                                 VirtualChild[] list,
                                 String filter,
                                 String rootPath,
                                 String virtualPath)
Method to create the DataElement object in the datastore out of a list of VirtualChildren


setProperties

public String setProperties(File fileObj)

setProperties

public String setProperties(File fileObj,
                            boolean doArchiveProperties)
Method to obtain the properties of file or folder.


setProperties

public String setProperties(VirtualChild fileObj)

getClassificationString

protected String getClassificationString(String s)
Method to obtain the classificatoin string of file or folder.


getFilterString

protected String getFilterString(String s)
Method to obtain the filter string of file or folder.


getShowHiddenFlag

protected boolean getShowHiddenFlag(String s)
Method to obtain the show Hidden flag for file or folder.


getDepth

protected int getDepth(String s)
Method to obtain the depth for a search


handleDownload

protected DataElement handleDownload(DataElement theElement,
                                     DataElement status)
Method to download a file.


handleQueryEncoding

protected DataElement handleQueryEncoding(DataElement subject,
                                          DataElement status)
Get the system encoding


handleQueryUnusedPort

protected DataElement handleQueryUnusedPort(DataElement subject,
                                            DataElement status)
Get an unused port number.


statusDone

public DataElement statusDone(DataElement status)
Complete status.


statusCancelled

public DataElement statusCancelled(DataElement status)
Cancel status.


load

public void load()
Description copied from class: Miner
Default method that gets called on a Miner when it is loaded. Override this function to perform some initialization at miner loading time.

Overrides:
load in class Miner
See Also:
Miner.load()

finish

public void finish()
Description copied from class: Miner
Shuts down the miner and cleans up it's meta-information. Override this function to do your own cleanup.

Overrides:
finish in class Miner

handleQueryClassName

protected DataElement handleQueryClassName(DataElement subject,
                                           DataElement status)
Retrieve the fully qualified class name (including package) for the specified .class file. This information is required by the distributed debugger.


handleQueryQualifiedClassName

protected DataElement handleQueryQualifiedClassName(DataElement subject,
                                                    DataElement status)
Retrieve the fully qualified class name (including package) for a class file.


handleGetOSType

public DataElement handleGetOSType(DataElement subject,
                                   DataElement status)
Method to retrieve the OS that the miner is running.


getInputStreamForFile

protected InputStream getInputStreamForFile(String filename)
                                     throws IOException
Throws:
IOException

extendSchema

public void extendSchema(DataElement schemaRoot)
Description copied from interface: ISchemaExtender
Add this tool's schema to the global DataStore schema. This interface must be implemented by each miner in order to populate the DataStore schema with information about this tool's object model and information about how to communicate with the tool from objects available to the user interface.

Specified by:
extendSchema in interface ISchemaExtender
Parameters:
schemaRoot - the descriptor root
See Also:
ISchemaExtender.extendSchema(DataElement)

getAbsoluteVirtualPath

public AbsoluteVirtualPath getAbsoluteVirtualPath(String path)

handleDeleteFromArchive

public DataElement handleDeleteFromArchive(DataElement subject,
                                           DataElement status)

handleQueryAllArchive

public DataElement handleQueryAllArchive(DataElement subject,
                                         DataElement attributes,
                                         DataElement status,
                                         boolean caseSensitive,
                                         boolean foldersOnly)

getArchiveHandlerFor

public ISystemArchiveHandler getArchiveHandlerFor(String archivePath)

handleCreateVirtualFile

public DataElement handleCreateVirtualFile(DataElement subject,
                                           DataElement status,
                                           String type)

handleCreateVirtualFolder

public DataElement handleCreateVirtualFolder(DataElement subject,
                                             DataElement status,
                                             String type)

handleCopy

public DataElement handleCopy(DataElement targetFolder,
                              DataElement sourceFile,
                              DataElement nameObj,
                              DataElement status)

isSpecialChar

protected boolean isSpecialChar(char c)
Checks whether the given character is a special character in the shell. A special character is '$', '`', '"' and '\'.

Parameters:
c - the character to check.
Returns:
true if the character is a special character, false otherwise.

getVersion

public String getVersion()
Description copied from class: Miner
Returns the version of this miner The expected format for this is ".." This MUST be overridden if version support is required FIXME make this abstract next release

Overrides:
getVersion in class Miner

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.