Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.subsystems.files.core.subsystems
Class RemoteFileSubSystem

java.lang.Object
  extended by 

org.eclipse.rse.core.model.RSEPersistableObject
      extended by 

org.eclipse.rse.core.model.PropertySetContainer
          extended by 

org.eclipse.rse.core.model.RSEModelObject
              extended by 

org.eclipse.rse.core.subsystems.SubSystem
                  extended by 
org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem
All Implemented Interfaces:
IAdaptable, ISchedulingRule, ISystemFilterPoolReferenceManagerProvider, IPropertySetContainer, IRSEModelObject, IRSEPersistableContainer, ICommunicationsListener, IRemoteObjectResolver, ISubSystem, IRemoteFileSubSystem
Direct Known Subclasses:
FileServiceSubSystem

public abstract class RemoteFileSubSystem
extends SubSystem
implements IRemoteFileSubSystem, ICommunicationsListener

Specialization for file subsystem factories. It is subclassed via use of a Rose model and MOF/EMF, or better yet by subclassing FileServiceSubSystem.

For your convenience, there is built-in name filtering support. To use it, call:

This class returns instances of RemoteFile objects.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.rse.core.subsystems. SubSystem
SubSystem.ChangeStatusJob, SubSystem.ConnectJob, SubSystem.DisconnectJob, SubSystem.DisplayErrorMessageJob, SubSystem.GetPropertiesJob, SubSystem.GetPropertyJob, SubSystem.ResolveAbsoluteJob, SubSystem.ResolveAbsolutesJob, SubSystem.ResolveRelativeJob, SubSystem.SetPropertiesJob, SubSystem.SetPropertyJob, SubSystem.SubSystemOperationJob, SubSystem.SystemMessageDialogRunnable
 
Field Summary
protected   HashMap _cachedRemoteFiles
           
protected   ArrayList _searchHistory
           
protected   RemoteFileFilterString currFilterString
           
protected   RemoteFileContext DEFAULT_CONTEXT
           
protected   RemoteFileContext DEFAULT_CONTEXT_NOFILTERSTRING
           
protected   RemoteFileFilterString FILTERSTRING_LISTROOTS
           
protected   NamePatternMatcher folderNameMatcher
           
protected   IMatcher matcher
           
  String osCmdShell
           
  String osName
           
 boolean osVarsSet
           
 boolean osWindows
           
 boolean osWindows95
           
 boolean osWindowsNT
           
 
Fields inherited from class org.eclipse.rse.core.subsystems. SubSystem
_connectionError, _connectorService, _disconnecting, _hidden, _host, _name, _subsystemConfigurationId, cancelable, doConnection, filterPoolReferenceManager, OPERATION_CANCEL_SHELL, OPERATION_CONNECT, OPERATION_DISCONNECT, OPERATION_GET_PROPERTIES, OPERATION_GET_PROPERTY, OPERATION_REMOVE_SHELL, OPERATION_RESOLVE_ABSOLUTE, OPERATION_RESOLVE_ABSOLUTES, OPERATION_RESOLVE_RELATIVE, OPERATION_RUN_COMMAND, OPERATION_RUN_SHELL, OPERATION_SEND_COMMAND_TO_SHELL, OPERATION_SET_PROPERTIES, OPERATION_SET_PROPERTY, parentSubSystemConfiguration, pmDialog, previousUserIdKey, runInThread, saveFileName, shell, sortResults, SUBSYSTEM_FILE_NAME, supportsConnecting
 
Fields inherited from interface org.eclipse.rse.core.model. IRSEPersistableContainer
NO_CHILDREN
 
Constructor Summary
RemoteFileSubSystem ( IHost host, IConnectorService connectorService)
          Default constructor.
 
Method Summary
protected  boolean accept ( String name, boolean isFile)
          Method to decide if a given folder or file name matches the present criteria.
protected  void addResolvedFilterStringObjects ( Vector allChildrenSoFar, Object[] childrenForThisFilterString, String[] allFilterStrings, int currFilterStringIndex)
          Overridable parent extension point for adding the results of a filter string to the overall list of results.
 void cacheRemoteFile ( IRemoteFile file)
          Store the IRemoteFile in a hashmap to quick subsequent retrieval
 void cacheRemoteFile ( IRemoteFile file, String path)
          Store the IRemoteFile in a hashmap to quick subsequent retrieval
 void cancelSearch ( IHostSearchResultConfiguration searchConfig)
          Deprecated. Do not call this method directly since it is not implemented.
 void communicationsStateChange ( CommunicationsEvent e)
          This method is invoked whenever the communications state is invoked immediately before and after the state of the communications changes.
 boolean doesFilterMatch ( ISystemFilter filter, String remoteObjectAbsoluteName)
          Return true if the given remote object name will pass the filtering criteria for any of the filter strings in this filter.
 boolean doesFilterStringListContentsOf ( ISystemFilterString filterString, String remoteObjectAbsoluteName)
          Return true if the given filter string lists the contents of the given remote object.
 boolean doesFilterStringMatch ( String filterString, String remoteObjectAbsoluteName, boolean caseSensitive)
          Return true if the given remote object name will pass the filtering criteria for the given filter string.
  IRemoteFile getCachedRemoteFile ( String path)
          Returns the cached remote file with the specified path.
protected   RemoteFileContext getContext ( IRemoteFile parent)
           
protected   RemoteFileContext getContext ( IRemoteFile parent, RemoteFileFilterString rffs)
           
protected   RemoteFileFilterString getCurrentFilterString ()
           
protected   RemoteFileContext getDefaultContext ()
           
protected   RemoteFileContext getDefaultContextNoFilterString ()
           
protected   RemoteFileFilterString getFilterStringListRoots ()
           
protected   String getFirstParentFilterString ( Object parent)
          Called by parent when we defer getting a filter string until later, where we query it from the parent.
  String getLineSeparator ()
          Return as a string the line separator.
  InetAddress getLocalAddress ()
          Returns the address found by calling InetAddress.getLocalHost().
  Object getObjectWithAbsoluteName ( String key, IProgressMonitor monitor)
          Return the object within the subsystem that corresponds to the specified unique ID.
  String getParentFolderName ( IRemoteFile folderOrFile)
          Given a folder or file, return its parent folder name, fully qualified
  IRemoteFileSubSystemConfiguration getParentRemoteFileSubSystemConfiguration ()
          Return parent subsystem factory, cast to a RemoteFileSubSystemConfiguration Assumes SubSystem.setSubSystemConfiguration(ISubSystemConfiguration) has already been called.
  String getPathSeparator ()
          Return in string format the character used to separate paths.
 char getPathSeparatorChar ()
          Return in char format the character used to separate paths.
  PropertyPage getPropertyPage ( Composite parent)
          Return the single property page to show in the tabbed notebook for the for SubSystem property of the parent Connection.
  String getRemoteEncoding ()
          Returns the local platform encoding if the default encoding of the host was not set.
  IRemoteFile[] getRemoteFileObjects ( String[] folderOrFileNames, IProgressMonitor monitor)
          Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it.
  IRemoteSearchResult getRemoteSearchResultObject ( String key)
          Given a key, returns a search result object for it.
  String getSeparator ()
          Return in string format the character used to separate folders.
 char getSeparatorChar ()
          Return in character format the character used to separate folders.
  Object getTargetForFilter ( ISystemFilterReference filterRef)
          Returns the parent object associated with a filter reference.
 int getUnusedPort ()
          Returns -1 by default.
 void initializeSubSystem ( IProgressMonitor monitor)
          Initialize this subsystem instance after the corresponding IConnectorService connect method finishes.
protected   Object[] internalResolveFilterString ( Object parent, String filterString, IProgressMonitor monitor)
          Actually resolve a relative filter string.
protected   Object[] internalResolveFilterString ( String filterString, IProgressMonitor monitor)
          Actually resolve an absolute filter string.
  Object[] internalResolveFilterStrings ( String[] filterStrings, IProgressMonitor monitor)
          Resolves filter strings.
protected   Object[] internalResolveOneFilterString ( Object parent, RemoteFileFilterString fs, boolean sort, IProgressMonitor monitor)
          Do one filter string relative resolve
 boolean isCaseSensitive ()
          Return true if file names are case-sensitive.
 boolean isPassiveCommunicationsListener ()
          This method determines if the communications listener is a passive or active listener.
 boolean isPrimarySubSystem ()
           
  IRemoteFile[] list ( IRemoteFile parent, int fileType, IProgressMonitor monitor)
          Return a list of all remote folders and files in the given folder.
  IRemoteFile[] list ( IRemoteFile parent, IProgressMonitor monitor)
          Return a list of all remote folders and files in the given folder.
  IRemoteFile[] list ( IRemoteFile parent, String fileNameFilter, int fileType, IProgressMonitor monitor)
          Return a list of remote folders and files in the given folder.
  IRemoteFile[] listMultiple ( IRemoteFile[] parents, int[] fileTypes, IProgressMonitor monitor)
          Return a list of all remote folders and files in the given folder.
  IRemoteFile[] listMultiple ( IRemoteFile[] parents, int fileType, IProgressMonitor monitor)
          Return a list of all remote folders and files in the given folder.
  IRemoteFile[] listRoots ( IProgressMonitor monitor)
          Return a list of roots/drives on the remote system
protected  void removeCachedRemoteFile ( IRemoteFile file)
           
protected  void removeCachedRemoteFile ( String path)
           
static int runLocalCommand ( String cmd, Vector lines)
          helper method to run an external command
protected  void setListValues (int includeFilesOrFolders, String nameFilter)
          Method to set variables to affect the folder content subsetting.
protected  void setListValues (int includeFilesOrFolders, String folderNameFilter, String fileNameFilter)
          Overloaded method to set variables to affect the folder content subsetting, when there is separate filters for both folder names and filter names.
  Object[] sortResolvedFilterStringObjects ( Object[] children)
          Sort the concatenated list of all objects returned by resolving one or more filter strings.
 void uninitializeSubSystem ( IProgressMonitor monitor)
          Uninitialize this subsystem just after disconnect.
 
Methods inherited from class org.eclipse.rse.core.subsystems. SubSystem
canSwitchTo, checkIsConnected, clearLocalUserId, commit, connect, connect, contains, deletingConnection, disconnect, disconnect, displayAsyncMsg, doesFilterListContentsOf, doesFilterTypeMatch, filterEventFilterCreated, filterEventFilterPoolReferenceCreated, filterEventFilterPoolReferenceDeleted, filterEventFilterPoolReferenceRenamed, filterEventFilterPoolReferenceReset, filterEventFilterPoolReferencesRePositioned, filterEventFilterPoolReferencesReset, filterEventFilterStringCreated, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, fireEvent, forceUserIdToUpperCase, getAdapter, getCacheManager, getChildren, getConfigurationId, getConnectionOwnedFilterPoolName, getConnectionPrivateFilterPool, getConnectorService, getExecutedCommands, getFilterPoolReferenceManager, getFilterReferenceWithAbsoluteName, getHost, getHostAliasName, getHostName, getInteractionProvider, getLocalUserId, getLocalUserId, getName, getObjectWithAbsoluteName, getPersistableChildren, getPersistableParent, getPreferencesKey, getPreferencesKey, getPrimarySubSystem, getProperties, getProperty, getQueryingMessage, getQueryingMessage, getRemoteAttribute, getResolvingMessage, getRunnableContext, getRunningMessage, getServiceType, getSettingMessage, getSettingMessage, getShell, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getTargetsForFilter, getUniqueOwningSystemFilterPool, getUserId, getVendorAttribute, hasChildren, implicitConnect, internalDisconnect, internalGetProperties, internalGetProperty, internalSetProperties, internalSetProperty, internalSwitchSubSystemConfiguration, isConflicting, isConnected, isConnectionError, isHidden, isOffline, promptForPassword, promptForPassword, renamingConnection, renamingProfile, resolveFilterString, resolveFilterString, resolveFilterStrings, scheduleJob, selectCommandSubSystem, setConfigurationId, setConnectionError, setConnectorService, setFilterPoolReferenceManager, setHidden, setHost, setInteractionProvider, setName, setProperties, setProperty, setRemoteAttribute, setSubSystemConfiguration, setVendorAttribute, showConnectCancelledMessage, showConnectErrorMessage, showDisconnectCancelledMessage, showDisconnectErrorMessage, showOperationCancelledMessage, showOperationErrorMessage, showOperationMessage, supportsCaching, switchServiceFactory
 
Methods inherited from class org.eclipse.rse.core.model. RSEModelObject
getDescription
 
Methods inherited from class org.eclipse.rse.core.model. PropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from class org.eclipse.rse.core.model. RSEPersistableObject
compareStrings, isDirty, isTainted, setDirty, setTainted, setWasRestored, wasRestored
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.rse.subsystems.files.core.subsystems. IRemoteFileSubSystem
copy, copyBatch, createFile, createFolder, createFolders, delete, deleteBatch, download, downloadMultiple, getInputStream, getLanguageUtilityFactory, getOutputStream, getOutputStream, getParentFolder, getRemoteFileObject, getRemoteFileObject, list, listMultiple, listMultiple, listRoots, move, rename, search, setLastModified, setReadOnly, supportsEncodingConversion, upload, upload, uploadMultiple, uploadMultiple
 
Methods inherited from interface org.eclipse.rse.core.subsystems. ISubSystem
canSwitchTo, checkIsConnected, clearLocalUserId, connect, connect, deletingConnection, disconnect, disconnect, doesFilterListContentsOf, forceUserIdToUpperCase, getCacheManager, getChildren, getConfigurationId, getConnectorService, getFilterPoolReferenceManager, getHost, getHostAliasName, getLocalUserId, getName, getPrimarySubSystem, getProperties, getProperty, getServiceType, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getUserId, getVendorAttribute, hasChildren, isConnected, isConnectionError, isHidden, isOffline, renamingConnection, renamingProfile, resolveFilterString, resolveFilterString, resolveFilterStrings, setConfigurationId, setConnectionError, setConnectorService, setFilterPoolReferenceManager, setHidden, setHost, setName, setProperties, setProperty, setSubSystemConfiguration, setVendorAttribute, supportsCaching, switchServiceFactory
 
Methods inherited from interface org.eclipse.rse.core.filters. ISystemFilterPoolReferenceManagerProvider
filterEventFilterCreated, filterEventFilterPoolReferenceCreated, filterEventFilterPoolReferenceDeleted, filterEventFilterPoolReferenceRenamed, filterEventFilterPoolReferenceReset, filterEventFilterPoolReferencesRePositioned, filterEventFilterPoolReferencesReset, filterEventFilterStringCreated, getUniqueOwningSystemFilterPool
 
Methods inherited from interface org.eclipse.rse.core.subsystems. IRemoteObjectResolver
getObjectWithAbsoluteName
 
Methods inherited from interface org.eclipse.core.runtime.jobs. ISchedulingRule
contains, isConflicting
 
Methods inherited from interface org.eclipse.rse.core.model. IRSEModelObject
getDescription
 
Methods inherited from interface org.eclipse.rse.core.model. IPropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from interface org.eclipse.rse.core.model. IRSEPersistableContainer
commit, getPersistableChildren, getPersistableParent, isDirty, isTainted, setDirty, setTainted, setWasRestored, wasRestored
 

Field Detail

osVarsSet

public boolean osVarsSet

osWindows

public boolean osWindows

osWindows95

public boolean osWindows95

osWindowsNT

public boolean osWindowsNT

osName

public 
String osName

osCmdShell

public 
String osCmdShell

matcher

protected 
IMatcher matcher

folderNameMatcher

protected 
NamePatternMatcher folderNameMatcher

currFilterString

protected 
RemoteFileFilterString currFilterString

FILTERSTRING_LISTROOTS

protected 
RemoteFileFilterString FILTERSTRING_LISTROOTS

DEFAULT_CONTEXT

protected 
RemoteFileContext DEFAULT_CONTEXT

DEFAULT_CONTEXT_NOFILTERSTRING

protected 
RemoteFileContext DEFAULT_CONTEXT_NOFILTERSTRING

_searchHistory

protected 
ArrayList _searchHistory

_cachedRemoteFiles

protected 
HashMap _cachedRemoteFiles
Constructor Detail

RemoteFileSubSystem

public RemoteFileSubSystem(
IHost host,
                           
IConnectorService connectorService)
Default constructor. Do not call directly! Rather, use the mof generated factory method to create. After instantiation, be sure to call SubSystem.setSubSystemConfiguration(ISubSystemConfiguration).

Method Detail

isPrimarySubSystem

public boolean isPrimarySubSystem()
Specified by:
isPrimarySubSystem in interface ISubSystem
Overrides:
isPrimarySubSystem in class SubSystem
Returns:
true if this subsystem's properties should take precedence over other subsystems that share the same IConnectorService

getParentRemoteFileSubSystemConfiguration

public 
IRemoteFileSubSystemConfiguration getParentRemoteFileSubSystemConfiguration()
Return parent subsystem factory, cast to a RemoteFileSubSystemConfiguration Assumes SubSystem.setSubSystemConfiguration(ISubSystemConfiguration) has already been called.

Specified by:
getParentRemoteFileSubSystemConfiguration in interface IRemoteFileSubSystem

isCaseSensitive

public boolean isCaseSensitive()
Return true if file names are case-sensitive. Used when doing name or type filtering Default is false, but can be overridden.

Specified by:
isCaseSensitive in interface IRemoteFileSubSystem

getCurrentFilterString

protected 
RemoteFileFilterString getCurrentFilterString()

getFilterStringListRoots

protected 
RemoteFileFilterString getFilterStringListRoots()

getDefaultContext

protected 
RemoteFileContext getDefaultContext()

getDefaultContextNoFilterString

protected 
RemoteFileContext getDefaultContextNoFilterString()

getContext

protected 
RemoteFileContext getContext(
IRemoteFile parent)

getContext

protected 
RemoteFileContext getContext(
IRemoteFile parent,
                                       
RemoteFileFilterString rffs)

getSeparator

public 
String getSeparator()
Return in string format the character used to separate folders. Eg, "\" or "/".
Shortcut to getParentRemoteFileSubSystemConfiguration().getSeparator()

Specified by:
getSeparator in interface IRemoteFileSubSystem

getSeparatorChar

public char getSeparatorChar()
Return in character format the character used to separate folders. Eg, "\" or "/"
Shortcut to getParentRemoteFileSubSystemConfiguration().getSeparatorChar()

Specified by:
getSeparatorChar in interface IRemoteFileSubSystem

getPathSeparator

public 
String getPathSeparator()
Return in string format the character used to separate paths. Eg, ";" or ":"
Shortcut to getParentRemoteFileSubSystemConfiguration().getPathSeparator()

Specified by:
getPathSeparator in interface IRemoteFileSubSystem

getPathSeparatorChar

public char getPathSeparatorChar()
Return in char format the character used to separate paths. Eg, ";" or ":"
Shortcut to getParentRemoteFileSubSystemConfiguration().getPathSeparatorChar()

Specified by:
getPathSeparatorChar in interface IRemoteFileSubSystem

getLineSeparator

public 
String getLineSeparator()
Return as a string the line separator.
Shortcut to getParentRemoteFileSubSystemConfiguration().getLineSeparator()

Specified by:
getLineSeparator in interface IRemoteFileSubSystem

getPropertyPage

public 
PropertyPage getPropertyPage(
Composite parent)
Return the single property page to show in the tabbed notebook for the for SubSystem property of the parent Connection. Return null if no page is to be contributed for this. You are limited to a single page, so you may have to compress. It is recommended you prompt for the port if applicable since the common base subsystem property page is not shown To help with this you can use the SubSystemPortPrompt widget.

Overrides:
getPropertyPage in class SubSystem

doesFilterMatch

public boolean doesFilterMatch(
ISystemFilter filter,
                               
String remoteObjectAbsoluteName)
Description copied from class: SubSystem
Return true if the given remote object name will pass the filtering criteria for any of the filter strings in this filter.

Subclasses do not need to override this method. Rather, this method walks each filter string and calls doesFilterStringMatch(...), and that is the method that child classes must override.

Specified by:
doesFilterMatch in interface ISubSystem
Overrides:
doesFilterMatch in class SubSystem
See Also:
SubSystem.doesFilterMatch(org.eclipse.rse.core.filters.ISystemFilter, java.lang.String)

doesFilterStringMatch

public boolean doesFilterStringMatch(
String filterString,
                                     
String remoteObjectAbsoluteName,
                                     boolean caseSensitive)
Return true if the given remote object name will pass the filtering criteria for the given filter string.

Subclasses need to override this. If in doubt, return true.

There is a hack here if you want to tell us the absolute name is that of a folder: append " -folder" to the name!

Specified by:
doesFilterStringMatch in interface ISubSystem
Overrides:
doesFilterStringMatch in class SubSystem

doesFilterStringListContentsOf

public boolean doesFilterStringListContentsOf(
ISystemFilterString filterString,
                                              
String remoteObjectAbsoluteName)
Return true if the given filter string lists the contents of the given remote object. For example, if given a folder, return true if the given filter string lists the contents of that folder. Used in impact analysis when a remote object is created, deleted, renamed, copied or moved, so as to establish which filters need to be refreshed or collapsed (if the folder is deleted, say).

This should only return true if the filter string directly lists the contents of the given object, versus indirectly.

Subclasses should override this.

Specified by:
doesFilterStringListContentsOf in interface ISubSystem
Overrides:
doesFilterStringListContentsOf in class SubSystem

internalResolveFilterStrings

public 
Object[] internalResolveFilterStrings(
String[] filterStrings,
                                             
IProgressMonitor monitor)
                                      throws 
InvocationTargetException,
                                             
InterruptedException
Resolves filter strings. The default implementation of this simply calls internalResolveFilterString(String, IProgressMonitor). If the result for each filter string is a SystemMessage (e.g. an error), then the messages are returned. If the result for any filter string is not a message (i.e. an array of children), then the children are returned, and the messages are not. This avoids mixing chuldren as a result of successful resolution of a filter string with messages that might result for other filter strings. So the returned results are always the successful results, or messages (never a mix of the two).

Overrides:
internalResolveFilterStrings in class SubSystem
Parameters:
filterStrings - array of filter patterns for objects to return.
monitor - the progress monitor we are running under
Returns:
Array of objects that are the result of resolving all the filter strings
Throws:
InvocationTargetException
InterruptedException
See Also:
SubSystem.internalResolveFilterStrings(java.lang.String[], org.eclipse.core.runtime.IProgressMonitor)

addResolvedFilterStringObjects

protected void addResolvedFilterStringObjects(
Vector allChildrenSoFar,
                                              
Object[] childrenForThisFilterString,
                                              
String[] allFilterStrings,
                                              int currFilterStringIndex)
Overridable parent extension point for adding the results of a filter string to the overall list of results.

Can be used to filter out redundant entries in the concatenated list, if this is desired.

Overrides:
addResolvedFilterStringObjects in class SubSystem

internalResolveFilterString

protected 
Object[] internalResolveFilterString(
String filterString,
                                               
IProgressMonitor monitor)
                                        throws 
InvocationTargetException,
                                               
InterruptedException
Actually resolve an absolute filter string. This is called by the run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.

Overrides:
internalResolveFilterString in class SubSystem
Throws:
InvocationTargetException
InterruptedException
See Also:
SubSystem.internalResolveFilterString(String,IProgressMonitor)

sortResolvedFilterStringObjects

public 
Object[] sortResolvedFilterStringObjects(
Object[] children)
Sort the concatenated list of all objects returned by resolving one or more filter strings. The default implementation does nothing. Child classes can override if they wish to show their resulting objects sorted.

Overrides:
sortResolvedFilterStringObjects in class SubSystem

getFirstParentFilterString

protected 
String getFirstParentFilterString(
Object parent)
Called by parent when we defer getting a filter string until later, where we query it from the parent. In this case we need the first filter string for the progress monitor msg.

Overrides:
getFirstParentFilterString in class SubSystem

internalResolveFilterString

protected 
Object[] internalResolveFilterString(
Object parent,
                                               
String filterString,
                                               
IProgressMonitor monitor)
                                        throws 
InvocationTargetException,
                                               
InterruptedException
Actually resolve a relative filter string. This is called by the run(IProgressMonitor monitor) method, which in turn is called by resolveFilterString.

As per IRunnableWithProgress rules:

  • if the user cancels (monitor.isCanceled()), throw new InterruptedException()
  • if something else bad happens, throw new java.lang.reflect.InvocationTargetException(exc);
  • do not worry about calling monitor.done() ... caller will do that!
YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS!

Overrides:
internalResolveFilterString in class SubSystem
Throws:
InvocationTargetException
InterruptedException

internalResolveOneFilterString

protected 
Object[] internalResolveOneFilterString(
Object parent,
                                                  
RemoteFileFilterString fs,
                                                  boolean sort,
                                                  
IProgressMonitor monitor)
                                           throws 
InvocationTargetException,
                                                  
InterruptedException,
                                                  
SystemMessageException
Do one filter string relative resolve

Throws:
InvocationTargetException
InterruptedException
SystemMessageException

listRoots

public 
IRemoteFile[] listRoots(
IProgressMonitor monitor)
                        throws 
InterruptedException
Return a list of roots/drives on the remote system

Specified by:
listRoots in interface IRemoteFileSubSystem
Throws:
InterruptedException

listMultiple

public 
IRemoteFile[] listMultiple(
IRemoteFile[] parents,
                                  int[] fileTypes,
                                  
IProgressMonitor monitor)
                           throws 
SystemMessageException
Return a list of all remote folders and files in the given folder. The list is not subsetted.

Specified by:
listMultiple in interface IRemoteFileSubSystem
Parameters:
parents - The parent folders to list folders and files in
fileTypes - - indicates whether to query files, folders, both or some other type
monitor - the progress monitor
Throws:
SystemMessageException
Since:
3.0

listMultiple

public 
IRemoteFile[] listMultiple(
IRemoteFile[] parents,
                                  int fileType,
                                  
IProgressMonitor monitor)
                           throws 
SystemMessageException
Return a list of all remote folders and files in the given folder. The list is not subsetted.

Specified by:
listMultiple in interface IRemoteFileSubSystem
Parameters:
parents - The parent folders to list folders and files in
fileType - - indicates whether to query files, folders, both or some other type
monitor - the progress monitor
Throws:
SystemMessageException
Since:
3.0

list

public 
IRemoteFile[] list(
IRemoteFile parent,
                          
IProgressMonitor monitor)
                   throws 
SystemMessageException
Return a list of all remote folders and files in the given folder. The list is not subsetted.

Specified by:
list in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list folders and files in
monitor - the progress monitor
Throws:
SystemMessageException
Since:
3.0 renamed from listFoldersAndFiles()

list

public 
IRemoteFile[] list(
IRemoteFile parent,
                          int fileType,
                          
IProgressMonitor monitor)
                   throws 
SystemMessageException
Return a list of all remote folders and files in the given folder. The list is not subsetted.

Specified by:
list in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list folders and files in
fileType - the type of file
monitor - the monitor
Throws:
SystemMessageException
Since:
3.0 using int fileType parameter

list

public 
IRemoteFile[] list(
IRemoteFile parent,
                          
String fileNameFilter,
                          int fileType,
                          
IProgressMonitor monitor)
                   throws 
SystemMessageException
Return a list of remote folders and files in the given folder.

The files part of the list is subsetted by the given file name filter. It can be null for no subsetting.

Specified by:
list in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list folders and files in
fileNameFilter - The name pattern to subset the file list by, or null to return all files.
fileType - the type of file
monitor - the monitor
Throws:
SystemMessageException
Since:
3.0 using int fileType parameter

getParentFolderName

public 
String getParentFolderName(
IRemoteFile folderOrFile)
Given a folder or file, return its parent folder name, fully qualified

Specified by:
getParentFolderName in interface IRemoteFileSubSystem
Parameters:
folderOrFile - folder or file to return parent of.

getRemoteSearchResultObject

public 
IRemoteSearchResult getRemoteSearchResultObject(
String key)
                                                throws 
SystemMessageException
Description copied from interface: IRemoteFileSubSystem
Given a key, returns a search result object for it. For the key, see <

Specified by:
getRemoteSearchResultObject in interface IRemoteFileSubSystem
Parameters:
key - the key that uniquely identifies a search result.
Throws:
SystemMessageException

getRemoteFileObjects

public 
IRemoteFile[] getRemoteFileObjects(
String[] folderOrFileNames,
                                          
IProgressMonitor monitor)
                                   throws 
SystemMessageException
Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it. Overrideable Override this method to provide optimized implementation

Specified by:
getRemoteFileObjects in interface IRemoteFileSubSystem
Parameters:
folderOrFileNames - Fully qualified folder or file names
monitor - the progress monitor
Returns:
the set of resources
Throws:
SystemMessageException
Since:
3.0

getObjectWithAbsoluteName

public 
Object getObjectWithAbsoluteName(
String key,
                                        
IProgressMonitor monitor)
                                 throws 
Exception
Return the object within the subsystem that corresponds to the specified unique ID. For remote files, assuming the key is the absolute path of a file, this is simply a wrapper to getRemoteFileObject().

Specified by:
getObjectWithAbsoluteName in interface IRemoteObjectResolver
Overrides:
getObjectWithAbsoluteName in class SubSystem
Parameters:
key - the unique id of the remote object. Must not be null.
monitor - the progress monitor
Returns:
the remote object instance, or null if no object is found with the given id.
Throws:
Exception - in case an error occurs contacting the remote system while retrieving the requested remote object. Extenders are encouraged to throw SystemMessageException in order to support good user feedback in case of errors. Since exceptions should only occur while retrieving new remote objects during startup, clients are typically allowed to ignore these exceptions and treat them as if the remote object were simply not there.
See Also:
SubSystem.getObjectWithAbsoluteName(String, IProgressMonitor)

setListValues

protected void setListValues(int includeFilesOrFolders,
                             
String nameFilter)
Method to set variables to affect the folder content subsetting. Use this when only listing either files or folders, but not both.

Parameters:
includeFilesOrFolders - A constant from IFileConstants
nameFilter - The pattern to filter the file or folder names by. Can be null to include all.

setListValues

protected void setListValues(int includeFilesOrFolders,
                             
String folderNameFilter,
                             
String fileNameFilter)
Overloaded method to set variables to affect the folder content subsetting, when there is separate filters for both folder names and filter names.

Parameters:
includeFilesOrFolders - A constant from IFileConstants
folderNameFilter - The pattern to filter the folder names by. Can be null to include all folders
fileNameFilter - The pattern to filter the file names by. Can be null to include all files

accept

protected boolean accept(
String name,
                         boolean isFile)
Method to decide if a given folder or file name matches the present criteria. You must have previously called setListValues(int, String) or setListValues(int, String, String)

Parameters:
name - The file or folder name to test
isFile - true if this is a file name, false if it is a folder name.
Returns:
true if the name matches the previously specified criteria

runLocalCommand

public static int runLocalCommand(
String cmd,
                                  
Vector lines)
                           throws 
Exception
helper method to run an external command

Throws:
Exception

initializeSubSystem

public void initializeSubSystem(
IProgressMonitor monitor)
                         throws 
SystemMessageException
Description copied from class: SubSystem
Initialize this subsystem instance after the corresponding IConnectorService connect method finishes. This method should be overridden if any initialization for the subsystem needs to occur at this time.

The default implementation currently does nothing, but overriding methods should call super before doing any other work.

Specified by:
initializeSubSystem in interface ISubSystem
Overrides:
initializeSubSystem in class SubSystem
Parameters:
monitor - a progress monitor that can be used to show progress during long-running operation. Cancellation is typically not supported since it might leave the system in an inconsistent state.
Throws:
SystemMessageException - if an error occurs during initialization.

uninitializeSubSystem

public void uninitializeSubSystem(
IProgressMonitor monitor)
Description copied from class: SubSystem
Uninitialize this subsystem just after disconnect. The default implementation currently does nothing. Overriding methods should call super after doing their own work.

Specified by:
uninitializeSubSystem in interface ISubSystem
Overrides:
uninitializeSubSystem in class SubSystem
Parameters:
monitor - a progress monitor that can be used to show progress during long-running operation. Cancellation is typically not supported since it might leave the system in an inconsistent state.

cacheRemoteFile

public void cacheRemoteFile(
IRemoteFile file,
                            
String path)
Store the IRemoteFile in a hashmap to quick subsequent retrieval

Parameters:
file - the file

cacheRemoteFile

public void cacheRemoteFile(
IRemoteFile file)
Store the IRemoteFile in a hashmap to quick subsequent retrieval

Parameters:
file - the file

getCachedRemoteFile

public 
IRemoteFile getCachedRemoteFile(
String path)
Returns the cached remote file with the specified path. If no such file is found, returns null

Parameters:
path -
Returns:
the cached file, if found in the cache, else null

removeCachedRemoteFile

protected void removeCachedRemoteFile(
IRemoteFile file)

removeCachedRemoteFile

protected void removeCachedRemoteFile(
String path)

communicationsStateChange

public void communicationsStateChange(
CommunicationsEvent e)
Description copied from interface: ICommunicationsListener
This method is invoked whenever the communications state is invoked immediately before and after the state of the communications changes. The state field in CommunicationsEvent determines which state change is about to or has occurred.

Specified by:
communicationsStateChange in interface ICommunicationsListener

isPassiveCommunicationsListener

public boolean isPassiveCommunicationsListener()
Description copied from interface: ICommunicationsListener
This method determines if the communications listener is a passive or active listener. Typically a passive listener registers with the communications system and responds to events as they occur. An active listener typically registers with the communications system only for the duration of the task (i.e. user editing a file, or outstanding communications request.) The user will be prompted on a disconnect if there are any active communication listeners registered.

Specified by:
isPassiveCommunicationsListener in interface ICommunicationsListener
Returns:
false if the communications listener is an active listener, true if the communications listener is a passive listener.
See Also:
ICommunicationsListener.isPassiveCommunicationsListener()

getUnusedPort

public int getUnusedPort()
Returns -1 by default. Subclasses should override if necessary.

Specified by:
getUnusedPort in interface IRemoteFileSubSystem
Returns:
an unused port number on the host, or -1 if none could be found.
See Also:
IRemoteFileSubSystem.getUnusedPort()

getLocalAddress

public 
InetAddress getLocalAddress()
Returns the address found by calling InetAddress.getLocalHost(). If that call returns the local loopback address, it returns null. Subclasses should reimplement to handle cases where systems have multiple IP addresses due to multiple network cards or VPN. This method should return an address that is usable from the remote system to connect back to the local system.

Specified by:
getLocalAddress in interface IRemoteFileSubSystem
Returns:
the local TCP/IP address accessible from the remote system, or null if no address can be resolved.
See Also:
IRemoteFileSubSystem.getLocalAddress()

getTargetForFilter

public 
Object getTargetForFilter(
ISystemFilterReference filterRef)
Description copied from interface: ISubSystem
Returns the parent object associated with a filter reference. It's up to the subsystem implementation to decide what "parent object" means for a filter reference.

Specified by:
getTargetForFilter in interface ISubSystem
Overrides:
getTargetForFilter in class SubSystem
Parameters:
filterRef - the filter reference to determine a target object from.
Returns:
An object representing the parent

cancelSearch

public void cancelSearch(
IHostSearchResultConfiguration searchConfig)
Deprecated. Do not call this method directly since it is not implemented.

Given a search configuration, cancel the search.

Specified by:
cancelSearch in interface IRemoteFileSubSystem
Parameters:
searchConfig - a search configuration.

getRemoteEncoding

public 
String getRemoteEncoding()
Returns the local platform encoding if the default encoding of the host was not set. Subclasses should override to return the actual remote encoding.

Specified by:
getRemoteEncoding in interface IRemoteFileSubSystem
Returns:
the encoding of the remote system.
See Also:
IRemoteFileSubSystem.getRemoteEncoding()

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire