RSE
Release 1.0

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

java.lang.Object
  extended byorg.eclipse.rse.core.model.PropertySetContainer
      extended byorg.eclipse.rse.core.model.RSEModelObject
          extended byorg.eclipse.rse.core.subsystems.SubSystem
              extended byorg.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem
All Implemented Interfaces:
IAdaptable, ICommunicationsListener, IPropertySetContainer, IRemoteFileSubSystem, IRemoteObjectResolver, IRSEModelObject, org.eclipse.rse.core.persistance.IRSEPersistableContainer, ISchedulingRule, ISubSystem, ISystemFilterPoolReferenceManagerProvider, ISystemResourceChangeEvents
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 org.eclipse.rse.core.servicesubsystem.impl.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 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 static String HOME_FOLDER_EDEFAULT
          The default value of the 'Home Folder' attribute
protected  String homeFolder
           
protected  IMatcher matcher
           
protected  IProgressMonitor monitor
           
 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 class org.eclipse.rse.core.model.RSEModelObject
_isDirty, _wasRestored
 
Fields inherited from interface org.eclipse.rse.model.ISystemResourceChangeEvents
EVENT_ADD, EVENT_ADD_FILTER_REFERENCE, EVENT_ADD_FILTERSTRING_REFERENCE, EVENT_ADD_MANY, EVENT_ADD_RELATIVE, EVENT_CHANGE_CHILDREN, EVENT_CHANGE_FILTER_REFERENCE, EVENT_CHANGE_FILTERSTRING_REFERENCE, EVENT_COLLAPSE_ALL, EVENT_COLLAPSE_SELECTED, EVENT_COMMAND_FINISHED, EVENT_COMMAND_HISTORY_UPDATE, EVENT_COMMAND_MESSAGE, EVENT_COMMAND_RUN, EVENT_COMMAND_SHELL_FINISHED, EVENT_COMMAND_SHELL_REMOVED, EVENT_COMPILE_COMMAND_RUN, EVENT_DELETE, EVENT_DELETE_FILTER_REFERENCE, EVENT_DELETE_FILTERSTRING_REFERENCE, EVENT_DELETE_MANY, EVENT_EXPAND_SELECTED, EVENT_ICON_CHANGE, EVENT_MOVE_FILTER_REFERENCES, EVENT_MOVE_FILTERSTRING_REFERENCES, EVENT_MOVE_MANY, EVENT_MUST_COLLAPSE, EVENT_PROPERTY_CHANGE, EVENT_PROPERTYSHEET_UPDATE, EVENT_REFRESH, EVENT_REFRESH_REMOTE, EVENT_REFRESH_SELECTED, EVENT_REFRESH_SELECTED_FILTER, EVENT_REFRESH_SELECTED_PARENT, EVENT_RENAME, EVENT_RENAME_FILTER_REFERENCE, EVENT_REPLACE_CHILDREN, EVENT_REVEAL_AND_SELECT, EVENT_SEARCH_FINISHED, EVENT_SELECT, EVENT_SELECT_EXPAND, EVENT_SELECT_REMOTE, PROPERTYSHEET_UPDATE_EVENT
 
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)
          Given a search configuration, cancel the search.
 boolean checkForCancel()
          Long running list processing calls this method to check for a user-cancel event.
 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.
 void download(IRemoteFile source, File destination, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void download(IRemoteFile source, File destination, String encoding, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void download(IRemoteFile source, IFile destination, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void download(IRemoteFile source, IFile destination, String encoding, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void download(IRemoteFile source, String destination, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void downloadUTF8(IRemoteFile source, File destination, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void downloadUTF8(IRemoteFile source, IFile destination, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void downloadUTF8(IRemoteFile source, String destination, IProgressMonitor monitor)
          Get the remote file and save it locally.
 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 getHomeFolder()
           
 String getLineSeparator()
          Return as a string the line separator.
 InetAddress getLocalAddress()
          Returns the address found by calling InetAddress.getLocalHost().
 Object getObjectWithAbsoluteName(String key)
          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.
 IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName)
          Given a un-qualified file or folder name, and its parent folder object, return an IRemoteFile object for the file.
 SystemRemoteResourceSet getRemoteFileObjects(List folderOrFileNames)
          Overrideable Override this method to provide optimized implementation 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)
          Called on each subsystem associated with a particular IConnectorService after it connects.
protected  Object[] internalResolveFilterString(IProgressMonitor monitor, Object parent, String filterString)
          Actually resolve a relative filter string.
protected  Object[] internalResolveFilterString(IProgressMonitor monitor, String filterString)
          Actually resolve an absolute filter string.
 Object[] internalResolveFilterStrings(IProgressMonitor monitor, String[] filterStrings)
          Resolves filter strings.
protected  Object[] internalResolveOneFilterString(IProgressMonitor monitor, Object parent, RemoteFileFilterString fs, boolean sort)
          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[] listFiles(IRemoteFile parent, IProgressMonitor monitor)
          Return a list of all remote files in the given parent folder on the remote system
 IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor)
          Return a list of remote files in the given folder, which match the given name pattern.
 IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor)
          Return a list of all remote folders in the given parent folder on the remote system
 IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor)
          Return a full list of remote folders in the given parent folder on the remote system.
 IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, IProgressMonitor monitor)
          Return a list of all remote folders and files in the given folder.
 IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor)
          Return a list of 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
 void setHomeFolder(String newHomeFolder)
           
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.
 String toString()
           
 void uninitializeSubSystem(IProgressMonitor monitor)
          Called on each subsystem associated with a particular IConnectorService after it disconnects
 void upload(File source, IRemoteFile destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void upload(File source, IRemoteFile destination, String encoding, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void upload(IFile source, IRemoteFile destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void upload(IFile source, IRemoteFile destination, String encoding, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void upload(String source, IRemoteFile destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void upload(String source, String destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void uploadUTF8(File source, IRemoteFile destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void uploadUTF8(IFile source, IRemoteFile destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void uploadUTF8(String source, IRemoteFile destination, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 
Methods inherited from class org.eclipse.rse.core.subsystems.SubSystem
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, getActiveWorkbenchShell, getActiveWorkbenchWindow, getAdapter, getCacheManager, getChildren, getConfigurationId, getConnectionOwnedFilterPoolName, getConnectionPrivateFilterPool, getConnectorService, getExecutedCommands, getFilterPoolReferenceManager, getFilterReferenceWithAbsoluteName, getHost, getHostAliasName, getHostName, getLocalUserId, getLocalUserId, getName, getPreferencesKey, getPreferencesKey, getPreferencesManager, getPrimarySubSystem, getProperties, getProperty, getQueryingMessage, getQueryingMessage, getRemoteAttribute, getResolvingMessage, getRunnableContext, getRunningMessage, getSettingMessage, getSettingMessage, getShell, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getSystemType, getTargetsForFilter, getUniqueOwningSystemFilterPool, getUserId, getVendorAttribute, hasChildren, implicitConnect, internalConnect, internalDisconnect, internalGetProperties, internalGetProperty, internalSetProperties, internalSetProperty, isConflicting, isConnected, isConnectionError, isHidden, isOffline, promptForPassword, promptForPassword, renamingConnection, renamingProfile, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterStrings, resolveFilterStrings, scheduleJob, selectCommandSubSystem, setConfigurationId, setConnectionError, setConnectorService, setFilterPoolReferenceManager, setHidden, setHost, setName, setProperties, setProperty, setRemoteAttribute, setSubSystemConfiguration, setVendorAttribute, showConnectCancelledMessage, showConnectErrorMessage, showDisconnectCancelledMessage, showDisconnectErrorMessage, showOperationCancelledMessage, showOperationErrorMessage, showOperationMessage, supportsCaching
 
Methods inherited from class org.eclipse.rse.core.model.RSEModelObject
compareStrings, getDescription, isDirty, setDirty, setWasRestored, wasRestored
 
Methods inherited from class org.eclipse.rse.core.model.PropertySetContainer
addPropertySet, addPropertySets, createPropertySet, createPropertySet, getPropertySet, getPropertySets, removePropertySet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem
copy, copyBatch, createFile, createFolder, createFolders, delete, deleteBatch, download, getLanguageUtilityFactory, getParentFolder, getRemoteEncoding, getRemoteFileObject, listFiles, listFolders, listFoldersAndFiles, listRoots, move, rename, search, setLastModified, setReadOnly, upload, upload, upload
 
Methods inherited from interface org.eclipse.rse.core.subsystems.ISubSystem
checkIsConnected, clearLocalUserId, connect, connect, deletingConnection, disconnect, disconnect, doesFilterListContentsOf, forceUserIdToUpperCase, getCacheManager, getChildren, getConfigurationId, getConnectorService, getFilterPoolReferenceManager, getHost, getHostAliasName, getLocalUserId, getName, getPrimarySubSystem, getProperties, getProperty, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getUserId, getVendorAttribute, hasChildren, isConnected, isConnectionError, isHidden, isOffline, renamingConnection, renamingProfile, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterString, resolveFilterStrings, resolveFilterStrings, setConfigurationId, setConnectionError, setConnectorService, setFilterPoolReferenceManager, setHidden, setHost, setName, setProperties, setProperty, setSubSystemConfiguration, setVendorAttribute, supportsCaching
 
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.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.persistance.IRSEPersistableContainer
commit, isDirty, setDirty, setWasRestored, wasRestored
 

Field Detail

HOME_FOLDER_EDEFAULT

protected static final String HOME_FOLDER_EDEFAULT
The default value of the 'Home Folder' attribute.

See Also:
getHomeFolder()

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

monitor

protected IProgressMonitor monitor

homeFolder

protected String homeFolder
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

checkForCancel

public boolean checkForCancel()
Long running list processing calls this method to check for a user-cancel event. If user did cancel, an exception is thrown.

Returns:
true if caller wants to cancel

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 interface: ISubSystem
Return true if the given remote object name will pass the filtering criteria for any of the filter strings in this filter.

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(IProgressMonitor monitor,
                                             String[] filterStrings)
                                      throws InvocationTargetException,
                                             InterruptedException
Resolves filter strings. The default implementation of this simply calls #internalResolveFilterString(IProgressMontior, String). 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:
monitor - the progress monitor we are running under
filterStrings - array of filter patterns for objects to return.
Returns:
Array of objects that are the result of resolving all the filter strings
Throws:
InvocationTargetException
InterruptedException
See Also:
SubSystem.internalResolveFilterStrings(org.eclipse.core.runtime.IProgressMonitor, java.lang.String[])

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(IProgressMonitor monitor,
                                               String filterString)
                                        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(IProgressMonitor,String)

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(IProgressMonitor monitor,
                                               Object parent,
                                               String filterString)
                                        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:

YOU MUST OVERRIDE THIS IF YOU SUPPORT FILTERS!

Overrides:
internalResolveFilterString in class SubSystem
Throws:
InvocationTargetException
InterruptedException

internalResolveOneFilterString

protected Object[] internalResolveOneFilterString(IProgressMonitor monitor,
                                                  Object parent,
                                                  RemoteFileFilterString fs,
                                                  boolean sort)
                                           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

listFolders

public IRemoteFile[] listFolders(IRemoteFile parent,
                                 IProgressMonitor monitor)
                          throws SystemMessageException
Return a list of all remote folders in the given parent folder on the remote system

Specified by:
listFolders in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list folders in
monitor - the progress monitor
Throws:
SystemMessageException

listFolders

public IRemoteFile[] listFolders(IRemoteFile parent,
                                 String fileNameFilter,
                                 IProgressMonitor monitor)
                          throws SystemMessageException
Return a full list of remote folders in the given parent folder on the remote system.

Specified by:
listFolders in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list folders in
fileNameFilter - The name pattern for subsetting the file list when this folder is subsequently expanded
monitor - the progress monitor
Throws:
SystemMessageException

listFiles

public IRemoteFile[] listFiles(IRemoteFile parent,
                               IProgressMonitor monitor)
                        throws SystemMessageException
Return a list of all remote files in the given parent folder on the remote system

Specified by:
listFiles in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list files in
monitor - the progress monitor
Throws:
SystemMessageException

listFiles

public IRemoteFile[] listFiles(IRemoteFile parent,
                               String fileNameFilter,
                               IProgressMonitor monitor)
                        throws SystemMessageException
Return a list of remote files in the given folder, which match the given name pattern.

Specified by:
listFiles in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list files in
fileNameFilter - The name pattern to subset the list by, or null to return all files.
monitor - the progress monitor
Throws:
SystemMessageException

listFoldersAndFiles

public IRemoteFile[] listFoldersAndFiles(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:
listFoldersAndFiles in interface IRemoteFileSubSystem
Parameters:
parent - The parent folder to list folders and files in
monitor - the progress monitor
Throws:
SystemMessageException

listFoldersAndFiles

public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent,
                                         String fileNameFilter,
                                         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:
listFoldersAndFiles 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.
monitor - the progress monitor
Throws:
SystemMessageException

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
See Also:
IRemoteFileSubSystem.getRemoteSearchResultObject(java.lang.String)

getRemoteFileObjects

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

Specified by:
getRemoteFileObjects in interface IRemoteFileSubSystem
Parameters:
folderOrFileNames - Fully qualified folder or file names
Throws:
SystemMessageException

getRemoteFileObject

public IRemoteFile getRemoteFileObject(IRemoteFile parent,
                                       String folderOrFileName)
                                throws SystemMessageException
Given a un-qualified file or folder name, and its parent folder object, return an IRemoteFile object for the file. noteThis method should be abstract but MOF doesn't allow abstract impl classes at this point

Specified by:
getRemoteFileObject in interface IRemoteFileSubSystem
Parameters:
parent - Folder containing the folder or file
folderOrFileName - Un-qualified folder or file name
Throws:
SystemMessageException

getObjectWithAbsoluteName

public Object getObjectWithAbsoluteName(String key)
                                 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
Throws:
Exception

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

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

download

public void download(IRemoteFile source,
                     String destination,
                     IProgressMonitor monitor)
              throws RemoteFileSecurityException,
                     RemoteFileIOException
Get the remote file and save it locally. The file is saved in the encoding of the operating system.

Specified by:
download in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the absolute path of the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

downloadUTF8

public void downloadUTF8(IRemoteFile source,
                         String destination,
                         IProgressMonitor monitor)
                  throws RemoteFileSecurityException,
                         RemoteFileIOException
Get the remote file and save it locally. The file is saved in UTF-8 encoding. This is a recommended method to use for file transfer

Specified by:
downloadUTF8 in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the absolute path of the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

download

public void download(IRemoteFile source,
                     File destination,
                     IProgressMonitor monitor)
              throws RemoteFileSecurityException,
                     RemoteFileIOException
Get the remote file and save it locally. The file is saved in the encoding of the operating system.

Specified by:
download in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

download

public void download(IRemoteFile source,
                     File destination,
                     String encoding,
                     IProgressMonitor monitor)
              throws RemoteFileSecurityException,
                     RemoteFileIOException
Get the remote file and save it locally. The file is saved in the encoding specified.

Specified by:
download in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the local file
encoding - the encoding of the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

downloadUTF8

public void downloadUTF8(IRemoteFile source,
                         File destination,
                         IProgressMonitor monitor)
                  throws RemoteFileSecurityException,
                         RemoteFileIOException
Get the remote file and save it locally. The file is saved in UTF-8 encoding. This is a recommended method to use for file transfer

Specified by:
downloadUTF8 in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

download

public void download(IRemoteFile source,
                     IFile destination,
                     IProgressMonitor monitor)
              throws RemoteFileSecurityException,
                     RemoteFileIOException
Get the remote file and save it locally. The file is saved in the encoding of the operating system.

Specified by:
download in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

download

public void download(IRemoteFile source,
                     IFile destination,
                     String encoding,
                     IProgressMonitor monitor)
              throws RemoteFileSecurityException,
                     RemoteFileIOException
Get the remote file and save it locally. The file is saved in the encoding specified.

Specified by:
download in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the local file
encoding - the encoding of the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

downloadUTF8

public void downloadUTF8(IRemoteFile source,
                         IFile destination,
                         IProgressMonitor monitor)
                  throws RemoteFileSecurityException,
                         RemoteFileIOException
Get the remote file and save it locally. The file is saved in UTF-8 encoding. This is a recommended method to use for file transfer

Specified by:
downloadUTF8 in interface IRemoteFileSubSystem
Parameters:
source - remote file that represents the file to be obtained
destination - the local file
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

upload

public void upload(String source,
                   IRemoteFile destination,
                   IProgressMonitor monitor)
            throws RemoteFileSecurityException,
                   RemoteFileIOException
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding of the local operating system

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the absolute path of the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

upload

public void upload(String source,
                   String destination,
                   IProgressMonitor monitor)
            throws RemoteFileSecurityException,
                   RemoteFileIOException
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding of the local operating system

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the absolute path of the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

uploadUTF8

public void uploadUTF8(String source,
                       IRemoteFile destination,
                       IProgressMonitor monitor)
                throws RemoteFileSecurityException,
                       RemoteFileIOException
Put the local copy of the remote file back to the remote location. The local file must be in UTF-8 encoding.

Specified by:
uploadUTF8 in interface IRemoteFileSubSystem
Parameters:
source - the absolute path of the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

upload

public void upload(File source,
                   IRemoteFile destination,
                   IProgressMonitor monitor)
            throws RemoteFileSecurityException,
                   RemoteFileIOException
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding of the local operating system

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

upload

public void upload(File source,
                   IRemoteFile destination,
                   String encoding,
                   IProgressMonitor monitor)
            throws RemoteFileSecurityException,
                   RemoteFileIOException
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding specified

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the local copy
destination - remote file that represents the file on the server
encoding - the encoding of the local copy
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

uploadUTF8

public void uploadUTF8(File source,
                       IRemoteFile destination,
                       IProgressMonitor monitor)
                throws RemoteFileSecurityException,
                       RemoteFileIOException
Put the local copy of the remote file back to the remote location. The local file must be in UTF-8 encoding.

Specified by:
uploadUTF8 in interface IRemoteFileSubSystem
Parameters:
source - the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

upload

public void upload(IFile source,
                   IRemoteFile destination,
                   IProgressMonitor monitor)
            throws RemoteFileSecurityException,
                   RemoteFileIOException
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding of the local operating system

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

upload

public void upload(IFile source,
                   IRemoteFile destination,
                   String encoding,
                   IProgressMonitor monitor)
            throws RemoteFileSecurityException,
                   RemoteFileIOException
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding specified

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the local copy
destination - remote file that represents the file on the server
encoding - the encoding of the local copy
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

uploadUTF8

public void uploadUTF8(IFile source,
                       IRemoteFile destination,
                       IProgressMonitor monitor)
                throws RemoteFileSecurityException,
                       RemoteFileIOException
Put the local copy of the remote file back to the remote location. The local file must be in UTF-8 encoding.

Specified by:
uploadUTF8 in interface IRemoteFileSubSystem
Parameters:
source - the local copy
destination - remote file that represents the file on the server
monitor - the progress monitor
Throws:
RemoteFileSecurityException
RemoteFileIOException

runLocalCommand

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

Throws:
Exception

getHomeFolder

public String getHomeFolder()
Specified by:
getHomeFolder in interface IRemoteFileSubSystem
Returns:
The value of the HomeFolder attribute

setHomeFolder

public void setHomeFolder(String newHomeFolder)
Specified by:
setHomeFolder in interface IRemoteFileSubSystem
Parameters:
newHomeFolder - The new value of the HomeFolder attribute

initializeSubSystem

public void initializeSubSystem(IProgressMonitor monitor)
Description copied from interface: ISubSystem
Called on each subsystem associated with a particular IConnectorService after it connects.

Specified by:
initializeSubSystem in interface ISubSystem
Overrides:
initializeSubSystem in class SubSystem
Parameters:
monitor - a monitor that can be used to show progress or provide cancellation.

uninitializeSubSystem

public void uninitializeSubSystem(IProgressMonitor monitor)
Description copied from interface: ISubSystem
Called on each subsystem associated with a particular IConnectorService after it disconnects

Specified by:
uninitializeSubSystem in interface ISubSystem
Overrides:
uninitializeSubSystem in class SubSystem
Parameters:
monitor - a progress monitor that can be used to show uninitialization progress can provide cancellation.

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 occured.

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 registeres 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()

toString

public String toString()

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

cancelSearch

public void cancelSearch(IHostSearchResultConfiguration searchConfig)
Deprecated.  

Description copied from interface: IRemoteFileSubSystem
Given a search configuration, cancel the search.

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

RSE
Release 1.0

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