RSE
Release 3.0

org.eclipse.rse.subsystems.files.core.servicesubsystem
Class FileServiceSubSystem

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
                      extended by org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem
All Implemented Interfaces:
IAdaptable, ISchedulingRule, ISystemFilterPoolReferenceManagerProvider, IPropertySetContainer, IRSEModelObject, IRSEPersistableContainer, ICommunicationsListener, IRemoteObjectResolver, ISubSystem, IFileServiceSubSystem, IRemoteFileSubSystem

public class FileServiceSubSystem
extends RemoteFileSubSystem
implements IFileServiceSubSystem

Generic Subsystem implementation for remote files. Clients may instantiate this class from their subsystem configurations.

Extending (overriding) this class is discouraged: configuration of the subsystem behavior should be done by providing a custom IFileService implementation wherever possible.


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  IFileService _hostFileService
           
protected  IHostFileToRemoteFileAdapter _hostFileToRemoteFileAdapter
           
protected  ISearchService _hostSearchService
           
protected  ILanguageUtilityFactory _languageUtilityFactory
           
protected  IRemoteFile _userHome
           
 
Fields inherited from class org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem
_cachedRemoteFiles, _searchHistory, currFilterString, DEFAULT_CONTEXT, DEFAULT_CONTEXT_NOFILTERSTRING, FILTERSTRING_LISTROOTS, folderNameMatcher, matcher, osCmdShell, osName, osVarsSet, osWindows, osWindows95, 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
FileServiceSubSystem(IHost host, IConnectorService connectorService, IFileService hostFileService, IHostFileToRemoteFileAdapter fileAdapter, ISearchService searchService)
           
 
Method Summary
 void cancelSearch(IHostSearchResultConfiguration searchConfig)
          Given a search configuration, cancel the search.
 boolean canSwitchTo(ISubSystemConfiguration configuration)
          Determine if a service subsystem is capable of switching to this new configuration.
 void copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor)
          Copy a file or folder to a new target parent folder.
 void copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor)
          Copy a set of remote files or folders to a new target parent folder.
 IRemoteFile createFile(IRemoteFile fileToCreate, IProgressMonitor monitor)
          Create a new file, given its IRemoteFile object (these do not have to represent existing files).
 IRemoteFile createFolder(IRemoteFile folderToCreate, IProgressMonitor monitor)
          Create a new folder, given its IRemoteFile object (these do not have to represent existing folders) The parent folder must exist for this to succeed.
 IRemoteFile createFolders(IRemoteFile folderToCreate, IProgressMonitor monitor)
          Given an IRemoteFile for a folder, this will create that folder and any missing parent folders in its path.
 IHostSearchResultConfiguration createSearchConfiguration(IHostSearchResultSet resultSet, Object searchTarget, SystemSearchString searchString)
           
 void delete(IRemoteFile folderOrFile, IProgressMonitor monitor)
          Delete the given remote file or folder.
 void deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor)
          Delete the given batch of remote file or folder.
 void download(IRemoteFile file, String localpath, String encoding, IProgressMonitor monitor)
          Get the remote file and save it locally.
 void downloadMultiple(IRemoteFile[] sources, String[] destinations, String[] encodings, IProgressMonitor monitor)
          Get the remote files and save them locally.
 IRemoteFileContext getContextFor(IRemoteFile file)
           
protected  IHostFile getFile(String parentPath, String fileName, IProgressMonitor monitor)
           
 IFileService getFileService()
          Returns the file service used by this subsystem.
 IHostFileToRemoteFileAdapter getHostFileToRemoteFileAdapter()
           
 InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor)
          Gets the input stream to access the contents a remote file. Defers to the file service.
 ILanguageUtilityFactory getLanguageUtilityFactory()
          Returns a language utility factory associated with this subsystem.
 OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor)
          Deprecated. Use getOutputStream(String, String, int, IProgressMonitor) instead
 OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor)
          Gets the output stream to write/append to a remote file.
 IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor)
          Given a folder or file, return its parent folder object.
 String getRemoteEncoding()
          Returns the encoding from the file service being used by this subsystem.
 IRemoteFile getRemoteFileObject(IRemoteFile parent, String folderOrFileName, IProgressMonitor monitor)
          Constructs an IRemoteFile object given an unqualified file or folder name and its parent folder object.
 IRemoteFile getRemoteFileObject(String folderOrFileName, IProgressMonitor monitor)
          Constructs and returns an IRemoteFile object given a fully-qualified file or folder name.
 IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, IProgressMonitor monitor)
          Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it.
protected  IHostFile[] getRoots(IProgressMonitor monitor)
           
 ISearchService getSearchService()
           
 Class getServiceType()
          Return the service type for this subsystem.
 IRemoteFileContext getTheDefaultContext()
           
protected  IRemoteFile getUserHome()
           
 void initializeSubSystem(IProgressMonitor monitor)
          Initialize this subsystem instance after the corresponding IConnectorService connect method finishes.
protected  IHostFile[] internalList(String parentPath, String fileNameFilter, int fileType, IProgressMonitor monitor)
          Return a list of children from the given parent path in service layer format.
protected  void internalSwitchSubSystemConfiguration(ISubSystemConfiguration newConfig)
          Perform the subsystem specific processing required to complete a subsystem configuration switch for a service subsystem.
protected  boolean isBinary(IRemoteFile source)
           
protected  boolean isBinary(String localEncoding, String hostEncoding, String remotePath)
           
 boolean isCaseSensitive()
          Return true if file names are case-sensitive.
 IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, int fileType, IProgressMonitor monitor)
          Return a list of remote folders and/or files in the given folder.
 IRemoteFile[] listMultiple(IRemoteFile[] parents, String[] fileNameFilters, int[] fileTypes, IProgressMonitor monitor)
          Return a list of remote folders and/or files in the given folder.
 IRemoteFile[] listMultiple(IRemoteFile[] parents, String[] fileNameFilters, int fileType, IProgressMonitor monitor)
          Return a list of remote folders and/or files in the given folder.
 IRemoteFile[] listRoots(IRemoteFileContext context, IProgressMonitor monitor)
          Return a list of roots/drives on the remote system.
 void move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor)
          Move a file or folder to a new target parent folder.
 void rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor)
          Rename the given remote file or folder.
 void search(IHostSearchResultConfiguration searchConfig)
          Given a search configuration, searches for its results.
 void setFileService(IFileService service)
           
 void setHostFileToRemoteFileAdapter(IHostFileToRemoteFileAdapter hostFileAdapter)
           
 void setLanguageUtilityFactory(ILanguageUtilityFactory factory)
           
 void setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor)
          Set the last modified date for the given file or folder.
 void setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor)
          Set a files read-only permissions.
 void setSearchService(ISearchService service)
           
 boolean supportsEncodingConversion()
          Indicates whether this file subsystem supports code page conversion using the IFileServiceCodePageConverter mechanism. Defers to the file service.
 void uninitializeSubSystem(IProgressMonitor monitor)
          Uninitialize this subsystem just after disconnect.
 void upload(String source, IRemoteFile destination, String encoding, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void upload(String source, String srcEncoding, String remotePath, String rmtEncoding, IProgressMonitor monitor)
          Put the local copy of the remote file back to the remote location.
 void uploadMultiple(String[] sources, IRemoteFile[] destinations, String[] encodings, IProgressMonitor monitor)
          Put the local copies of the remote files to the remote locations.
 void uploadMultiple(String[] sources, String[] srcEncodings, String[] remotePaths, String[] rmtEncodings, IProgressMonitor monitor)
          Put the local copies of the remote files to the remote locations.
 
Methods inherited from class org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem
accept, addResolvedFilterStringObjects, cacheRemoteFile, cacheRemoteFile, communicationsStateChange, doesFilterMatch, doesFilterStringListContentsOf, doesFilterStringMatch, getCachedRemoteFile, getContext, getContext, getCurrentFilterString, getDefaultContext, getDefaultContextNoFilterString, getFilterStringListRoots, getFirstParentFilterString, getLineSeparator, getLocalAddress, getObjectWithAbsoluteName, getParentFolderName, getParentRemoteFileSubSystemConfiguration, getPathSeparator, getPathSeparatorChar, getPropertyPage, getRemoteSearchResultObject, getSeparator, getSeparatorChar, getTargetForFilter, getUnusedPort, internalResolveFilterString, internalResolveFilterString, internalResolveFilterStrings, internalResolveOneFilterString, isPassiveCommunicationsListener, isPrimarySubSystem, list, list, list, listMultiple, listMultiple, listRoots, removeCachedRemoteFile, removeCachedRemoteFile, runLocalCommand, setListValues, setListValues, sortResolvedFilterStringObjects
 
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, 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, getSettingMessage, getSettingMessage, getShell, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getTargetsForFilter, getUniqueOwningSystemFilterPool, getUserId, getVendorAttribute, hasChildren, implicitConnect, internalDisconnect, internalGetProperties, internalGetProperty, internalSetProperties, internalSetProperty, 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
getLineSeparator, getLocalAddress, getParentFolderName, getParentRemoteFileSubSystemConfiguration, getPathSeparator, getPathSeparatorChar, getRemoteSearchResultObject, getSeparator, getSeparatorChar, getUnusedPort, list, list, list, listMultiple, listMultiple, listRoots
 
Methods inherited from interface org.eclipse.rse.core.subsystems.ISubSystem
checkIsConnected, clearLocalUserId, connect, connect, deletingConnection, disconnect, disconnect, doesFilterListContentsOf, doesFilterMatch, doesFilterStringListContentsOf, doesFilterStringMatch, forceUserIdToUpperCase, getCacheManager, getChildren, getConfigurationId, getConnectorService, getFilterPoolReferenceManager, getHost, getHostAliasName, getLocalUserId, getName, getPrimarySubSystem, getProperties, getProperty, getSubSystemConfiguration, getSystemFilterPoolReferenceManager, getSystemProfile, getSystemProfileName, getTargetForFilter, getUserId, getVendorAttribute, hasChildren, isConnected, isConnectionError, isHidden, isOffline, isPrimarySubSystem, 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, 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

_languageUtilityFactory

protected ILanguageUtilityFactory _languageUtilityFactory

_hostFileService

protected IFileService _hostFileService

_hostSearchService

protected ISearchService _hostSearchService

_hostFileToRemoteFileAdapter

protected IHostFileToRemoteFileAdapter _hostFileToRemoteFileAdapter

_userHome

protected IRemoteFile _userHome
Constructor Detail

FileServiceSubSystem

public FileServiceSubSystem(IHost host,
                            IConnectorService connectorService,
                            IFileService hostFileService,
                            IHostFileToRemoteFileAdapter fileAdapter,
                            ISearchService searchService)
Method Detail

isCaseSensitive

public boolean isCaseSensitive()
Description copied from class: RemoteFileSubSystem
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
Overrides:
isCaseSensitive in class RemoteFileSubSystem

getContextFor

public IRemoteFileContext getContextFor(IRemoteFile file)

getTheDefaultContext

public IRemoteFileContext getTheDefaultContext()

getFileService

public IFileService getFileService()
Description copied from interface: IFileServiceSubSystem
Returns the file service used by this subsystem. By wrapping this service we can easily share it among connections or subsystems if that is desired.

Specified by:
getFileService in interface IFileServiceSubSystem
Returns:
the file service wrapped by this subsystem.

setFileService

public void setFileService(IFileService service)

getSearchService

public ISearchService getSearchService()

setSearchService

public void setSearchService(ISearchService service)

getHostFileToRemoteFileAdapter

public IHostFileToRemoteFileAdapter getHostFileToRemoteFileAdapter()
Specified by:
getHostFileToRemoteFileAdapter in interface IFileServiceSubSystem

setHostFileToRemoteFileAdapter

public void setHostFileToRemoteFileAdapter(IHostFileToRemoteFileAdapter hostFileAdapter)

getRemoteFileObject

public IRemoteFile getRemoteFileObject(IRemoteFile parent,
                                       String folderOrFileName,
                                       IProgressMonitor monitor)
                                throws SystemMessageException
Constructs an IRemoteFile object given an unqualified file or folder name and its parent folder object.

Specified by:
getRemoteFileObject in interface IRemoteFileSubSystem
Parameters:
parent - Folder containing the folder or file
folderOrFileName - Un-qualified folder or file name
monitor - the progress monitor
Returns:
an IRemoteFile object for the file.
Throws:
SystemMessageException
See Also:
IRemoteFile

getRemoteFileObject

public IRemoteFile getRemoteFileObject(String folderOrFileName,
                                       IProgressMonitor monitor)
                                throws SystemMessageException
Constructs and returns an IRemoteFile object given a fully-qualified file or folder name.

Specified by:
getRemoteFileObject in interface IRemoteFileSubSystem
Parameters:
folderOrFileName - Fully qualified folder or file name
monitor - the progress monitor
Returns:
The constructed IRemoteFile
Throws:
SystemMessageException - in case an error occurs contacting the remote system while retrieving the requested remote object.
See Also:
IRemoteFile

getUserHome

protected IRemoteFile getUserHome()
Returns:
The IRemoteFile that is the user's home directory on this remote file system. The remote file system is assumed to have a concept of a home directory.

internalList

protected IHostFile[] internalList(String parentPath,
                                   String fileNameFilter,
                                   int fileType,
                                   IProgressMonitor monitor)
                            throws SystemMessageException
Return a list of children from the given parent path in service layer format. Was unified from the previous methods getFolders(), getFiles() and getFilesAndFolders() in RSE 3.0

Throws:
SystemMessageException
Since:
3.0

getFile

protected IHostFile getFile(String parentPath,
                            String fileName,
                            IProgressMonitor monitor)
                     throws SystemMessageException
Throws:
SystemMessageException

getRoots

protected IHostFile[] getRoots(IProgressMonitor monitor)
                        throws InterruptedException,
                               SystemMessageException
Throws:
InterruptedException
SystemMessageException

getRemoteFileObjects

public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames,
                                          IProgressMonitor monitor)
                                   throws SystemMessageException
Description copied from class: RemoteFileSubSystem
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
Overrides:
getRemoteFileObjects in class RemoteFileSubSystem
Parameters:
folderOrFileNames - Fully qualified folder or file names
monitor - the progress monitor
Returns:
the set of resources
Throws:
SystemMessageException

listMultiple

public IRemoteFile[] listMultiple(IRemoteFile[] parents,
                                  String[] fileNameFilters,
                                  int[] fileTypes,
                                  IProgressMonitor monitor)
                           throws SystemMessageException
Return a list of remote folders and/or files in the given folder. Only file names are filtered by the given file name filters. It can be null for no sub-setting.

Specified by:
listMultiple in interface IRemoteFileSubSystem
Parameters:
parents - The parent folders to list folders and files in
fileNameFilters - The name patterns to subset the file list by, or null to return all files. There should be exactly one fileNameFilter per parent.
fileTypes - - indicates whether to query files, folders, both or some other type. There should be exactly one fileType specified per parent. For the default list of available file types see IFileServiceContants
monitor - the progress monitor
Throws:
SystemMessageException
Since:
3.0

listMultiple

public IRemoteFile[] listMultiple(IRemoteFile[] parents,
                                  String[] fileNameFilters,
                                  int fileType,
                                  IProgressMonitor monitor)
                           throws SystemMessageException
Return a list of remote folders and/or files in the given folder. Only file names are filtered by the given file name filters. It can be null for no sub-setting.

Specified by:
listMultiple in interface IRemoteFileSubSystem
Parameters:
parents - The parent folders to list folders and files in
fileNameFilters - The name patterns to subset the file list by, or null to return all files. There should be exactly one fileNameFilter per parent.
fileType - - indicates whether to query files, folders, both or some other type. Available file types include IFileService.FILE_TYPE_FILES, IFileService.FILE_TYPE_FOLDERS, and IFileService.FILE_TYPE_FILES_AND_FOLDERS.
monitor - the progress monitor
Throws:
SystemMessageException
Since:
3.0

list

public IRemoteFile[] list(IRemoteFile parent,
                          String fileNameFilter,
                          IRemoteFileContext context,
                          int fileType,
                          IProgressMonitor monitor)
                   throws SystemMessageException
Return a list of remote folders and/or files in the given folder. The files part of the list is filtered by the given file name filter. It can be null for no filtering.

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.
context - The holder of state information - indicates whether to query files, folders, both or some other type
fileType - - indicates whether to query files, folders, both or some other type For the default list of available file types see IFileServiceContants
monitor - the progress monitor
Throws:
SystemMessageException
Since:
3.0

listRoots

public IRemoteFile[] listRoots(IRemoteFileContext context,
                               IProgressMonitor monitor)
                        throws InterruptedException
Description copied from interface: IRemoteFileSubSystem
Return a list of roots/drives on the remote system. This version is called by RemoteFileSubSystemImpl's resolveFilterString(s) noteThis method should be abstract but MOF doesn't allow abstract impl classes at this point

Specified by:
listRoots in interface IRemoteFileSubSystem
Throws:
InterruptedException

isBinary

protected boolean isBinary(String localEncoding,
                           String hostEncoding,
                           String remotePath)

isBinary

protected boolean isBinary(IRemoteFile source)

upload

public void upload(String source,
                   String srcEncoding,
                   String remotePath,
                   String rmtEncoding,
                   IProgressMonitor monitor)
            throws SystemMessageException
Description copied from interface: IRemoteFileSubSystem
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, with two exceptions:

Specified by:
upload in interface IRemoteFileSubSystem
Parameters:
source - the absolute path of the local copy
srcEncoding - the encoding of the local copy
remotePath - remote file that represents the file on the server
rmtEncoding - the encoding of the remote file.
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.

upload

public void upload(String source,
                   IRemoteFile destination,
                   String encoding,
                   IProgressMonitor monitor)
            throws SystemMessageException
Description copied from interface: IRemoteFileSubSystem
Put the local copy of the remote file back to the remote location. The file is assumed to be in the encoding specified, with two exceptions:

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
encoding - the encoding of the local copy
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.

uploadMultiple

public void uploadMultiple(String[] sources,
                           String[] srcEncodings,
                           String[] remotePaths,
                           String[] rmtEncodings,
                           IProgressMonitor monitor)
                    throws SystemMessageException
Put the local copies of the remote files to the remote locations. The files are assumed to be in the encodings of the local operating system, with two exceptions:

Specified by:
uploadMultiple in interface IRemoteFileSubSystem
Parameters:
sources - the absolute paths of the local copies
srcEncodings - the encodings of the local copies
remotePaths - remote files that represents the files on the server
rmtEncodings - the encodings of the remote files.
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0

uploadMultiple

public void uploadMultiple(String[] sources,
                           IRemoteFile[] destinations,
                           String[] encodings,
                           IProgressMonitor monitor)
                    throws SystemMessageException
Put the local copies of the remote files to the remote locations. The files are assumed to be in the encodings specified, with two exceptions:

Specified by:
uploadMultiple in interface IRemoteFileSubSystem
Parameters:
sources - the absolute paths of the local copies
destinations - remote files that represent the files on the server
encodings - the encodings of the local copies
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0

download

public void download(IRemoteFile file,
                     String localpath,
                     String encoding,
                     IProgressMonitor monitor)
              throws SystemMessageException
Description copied from interface: IRemoteFileSubSystem
Get the remote file and save it locally. The file is saved in the encoding specified, with two exceptions:

Specified by:
download in interface IRemoteFileSubSystem
Parameters:
file - remote file that represents the file to be obtained
localpath - the absolute path of the local file
encoding - the encoding of the local file
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.

downloadMultiple

public void downloadMultiple(IRemoteFile[] sources,
                             String[] destinations,
                             String[] encodings,
                             IProgressMonitor monitor)
                      throws SystemMessageException
Get the remote files and save them locally. The files are saved in the encodings specified, with two exceptions:

Specified by:
downloadMultiple in interface IRemoteFileSubSystem
Parameters:
sources - remote files that represent the files to be obtained
destinations - the absolute paths of the local files
encodings - the encodings of the local files
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0

copy

public void copy(IRemoteFile sourceFolderOrFile,
                 IRemoteFile targetFolder,
                 String newName,
                 IProgressMonitor monitor)
          throws SystemMessageException
Copy a file or folder to a new target parent folder.

Specified by:
copy in interface IRemoteFileSubSystem
Parameters:
sourceFolderOrFile - The file or folder to copy
targetFolder - The folder to copy to. No guarantee it is on the same system, so be sure to check getSystemConnection()!
newName - The new name for the copied file or folder
monitor - progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

copyBatch

public void copyBatch(IRemoteFile[] sourceFolderOrFiles,
                      IRemoteFile targetFolder,
                      IProgressMonitor monitor)
               throws SystemMessageException
Copy a set of remote files or folders to a new target parent folder. Precondition: Sources and target must all be on the same system.

If an error occurs during the copy of an item, this operation stops on that item and a SystemMessageException is thrown. Items copied before that item will remain copied. Items copied after that item will not be copied. The item on which the error occurs will not be copied.

Specified by:
copyBatch in interface IRemoteFileSubSystem
Parameters:
sourceFolderOrFiles - The file or folder to copy
targetFolder - The folder to copy to.
monitor - progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

getParentFolder

public IRemoteFile getParentFolder(IRemoteFile folderOrFile,
                                   IProgressMonitor monitor)
Description copied from interface: IRemoteFileSubSystem
Given a folder or file, return its parent folder object.

Specified by:
getParentFolder in interface IRemoteFileSubSystem
Parameters:
folderOrFile - folder or file to return parent of.
monitor - the progress monitor
Returns:
the remote file

createFile

public IRemoteFile createFile(IRemoteFile fileToCreate,
                              IProgressMonitor monitor)
                       throws SystemMessageException
Description copied from interface: IRemoteFileSubSystem
Create a new file, given its IRemoteFile object (these do not have to represent existing files).

Specified by:
createFile in interface IRemoteFileSubSystem
Parameters:
fileToCreate - The object representing the file to be created.
Returns:
The same input object returned for convenience. Will throw exception if it fails.
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
See Also:
IRemoteFileSubSystem.createFolders(IRemoteFile,IProgressMonitor)

createFolder

public IRemoteFile createFolder(IRemoteFile folderToCreate,
                                IProgressMonitor monitor)
                         throws SystemMessageException
Description copied from interface: IRemoteFileSubSystem
Create a new folder, given its IRemoteFile object (these do not have to represent existing folders)

Specified by:
createFolder in interface IRemoteFileSubSystem
Parameters:
folderToCreate - The object representing the folder to be created.
monitor - the progress monitor
Returns:
The same input object returned for convenience. Will throw exception if it fails.
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
See Also:
IRemoteFileSubSystem.createFolders(IRemoteFile, IProgressMonitor)

createFolders

public IRemoteFile createFolders(IRemoteFile folderToCreate,
                                 IProgressMonitor monitor)
                          throws SystemMessageException
Description copied from interface: IRemoteFileSubSystem
Given an IRemoteFile for a folder, this will create that folder and any missing parent folders in its path. Use getParentFolder to get the parent object of your file or folder in order to call this method.

Specified by:
createFolders in interface IRemoteFileSubSystem
Parameters:
folderToCreate - The object representing the folder to be created, along with its parents.
monitor - the progress monitor
Returns:
The same input object returned for convenience. Will throw exception if it fails.
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
See Also:
IRemoteFileSubSystem.getParentFolder(IRemoteFile, IProgressMonitor)

delete

public void delete(IRemoteFile folderOrFile,
                   IProgressMonitor monitor)
            throws SystemMessageException
Delete the given remote file or folder.

Specified by:
delete in interface IRemoteFileSubSystem
Parameters:
folderOrFile - represents the object to be deleted.
monitor - progressMonitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

deleteBatch

public void deleteBatch(IRemoteFile[] folderOrFiles,
                        IProgressMonitor monitor)
                 throws SystemMessageException
Delete the given batch of remote file or folder.

If an error occurs during the deletion of an item, this operation stops on that item and a SystemMessageException is thrown. Items deleted before that item will remain deleted. Items specified after that item will not be deleted. The item on which the error occurs will not be deleted. Without an exception thrown in such cases, views may not be refreshed correctly to account for deleted resources.

Specified by:
deleteBatch in interface IRemoteFileSubSystem
Parameters:
folderOrFiles - represents the objects to be deleted.
monitor - progressMonitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

rename

public void rename(IRemoteFile folderOrFile,
                   String newName,
                   IProgressMonitor monitor)
            throws SystemMessageException
Rename the given remote file or folder. This renames it in memory and, iff it exists, on disk.

Specified by:
rename in interface IRemoteFileSubSystem
Parameters:
folderOrFile - represents the object to be renamed.
newName - new name to give it.
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

move

public void move(IRemoteFile sourceFolderOrFile,
                 IRemoteFile targetFolder,
                 String newName,
                 IProgressMonitor monitor)
          throws SystemMessageException
Move a file or folder to a new target parent folder.

Specified by:
move in interface IRemoteFileSubSystem
Parameters:
sourceFolderOrFile - The file or folder to move
targetFolder - The folder to move to. No guarantee it is on the same system, so be sure to check getSystemConnection()!
newName - The new name for the moved file or folder
monitor - progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

setLastModified

public void setLastModified(IRemoteFile folderOrFile,
                            long newDate,
                            IProgressMonitor monitor)
                     throws SystemMessageException
Set the last modified date for the given file or folder. Like a Unix "touch" operation. Folder or file must exist on disk for this to succeed.

Specified by:
setLastModified in interface IRemoteFileSubSystem
Parameters:
folderOrFile - represents the object to be renamed.
newDate - new date, in milliseconds from epoch, to assign.
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

setReadOnly

public void setReadOnly(IRemoteFile folderOrFile,
                        boolean readOnly,
                        IProgressMonitor monitor)
                 throws SystemMessageException
Set a files read-only permissions. Folder or file must exist on disk for this to succeed.

Specified by:
setReadOnly in interface IRemoteFileSubSystem
Parameters:
folderOrFile - represents the object to be renamed.
readOnly - whether to set it to be read-only or not
monitor - the progress monitor
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.
Since:
3.0 returns void

getLanguageUtilityFactory

public ILanguageUtilityFactory getLanguageUtilityFactory()
Description copied from interface: IRemoteFileSubSystem
Returns a language utility factory associated with this subsystem.

Specified by:
getLanguageUtilityFactory in interface IRemoteFileSubSystem
Returns:
the language utility factory associated with this subsystem.

setLanguageUtilityFactory

public void setLanguageUtilityFactory(ILanguageUtilityFactory factory)

search

public void search(IHostSearchResultConfiguration searchConfig)
Description copied from interface: IRemoteFileSubSystem
Given a search configuration, searches for its results.

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

cancelSearch

public void cancelSearch(IHostSearchResultConfiguration searchConfig)
Given a search configuration, cancel the search.

Specified by:
cancelSearch in interface IRemoteFileSubSystem
Overrides:
cancelSearch in class RemoteFileSubSystem
Parameters:
searchConfig - a search configuration.
See Also:
IRemoteFileSubSystem.cancelSearch(IHostSearchResultConfiguration)

createSearchConfiguration

public IHostSearchResultConfiguration createSearchConfiguration(IHostSearchResultSet resultSet,
                                                                Object searchTarget,
                                                                SystemSearchString searchString)
Specified by:
createSearchConfiguration in interface IFileServiceSubSystem

canSwitchTo

public boolean canSwitchTo(ISubSystemConfiguration configuration)
Description copied from class: SubSystem
Determine if a service subsystem is capable of switching to this new configuration. This is usually a test of this configuration's type against the type expected by this subsystem. This supplied implementation returns false. Subclasses should override if they implement a service subsystem.

Specified by:
canSwitchTo in interface ISubSystem
Overrides:
canSwitchTo in class SubSystem
Parameters:
configuration - the configuration to which this subsystem may switch
Returns:
true if this subsystem is capable of switching to this configuration, false otherwise. This implementation returns false.
See Also:
ISubSystem.canSwitchTo(ISubSystemConfiguration)

internalSwitchSubSystemConfiguration

protected void internalSwitchSubSystemConfiguration(ISubSystemConfiguration newConfig)
Description copied from class: SubSystem
Perform the subsystem specific processing required to complete a subsystem configuration switch for a service subsystem. The subsystem will typically query this configuration for interesting properties or policies. It should also reset any state to a fresh start. This supplied implementation does nothing. Subclasses may override if they implement a service subsystem.

Overrides:
internalSwitchSubSystemConfiguration in class SubSystem
Parameters:
newConfig - the configuration this subsystem should use from this point.

getServiceType

public Class getServiceType()
Description copied from class: SubSystem
Return the service type for this subsystem.

Specified by:
getServiceType in interface ISubSystem
Overrides:
getServiceType in class SubSystem
Returns:
the default implementation returns null. Subclasses that implement service subsystems should return a type as specified in the interface.
See Also:
ISubSystem.getServiceType()

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

getRemoteEncoding

public String getRemoteEncoding()
Returns the encoding from the file service being used by this subsystem.

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

getInputStream

public InputStream getInputStream(String remoteParent,
                                  String remoteFile,
                                  boolean isBinary,
                                  IProgressMonitor monitor)
                           throws SystemMessageException
Gets the input stream to access the contents a remote file. Clients should close the input stream when done. Implementations should not return null. Defers to the file service. The method is basically another way to do download.

Specified by:
getInputStream in interface IRemoteFileSubSystem
Parameters:
remoteParent - the absolute path of the parent.
remoteFile - the name of the remote file.
isBinary - true if the file is a binary file, false otherwise.
monitor - the progress monitor.
Returns:
the input stream to access the contents of the remote file.
Throws:
SystemMessageException - if an error occurs.
See Also:
IRemoteFileSubSystem.getInputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor)

getOutputStream

public OutputStream getOutputStream(String remoteParent,
                                    String remoteFile,
                                    boolean isBinary,
                                    IProgressMonitor monitor)
                             throws SystemMessageException
Deprecated. Use getOutputStream(String, String, int, IProgressMonitor) instead

Gets the output stream to write to a remote file. Clients should close the output stream when done. Implementations should not return null.

Specified by:
getOutputStream in interface IRemoteFileSubSystem
Parameters:
remoteParent - the absolute path of the parent.
remoteFile - the name of the remote file.
isBinary - true if the file is a binary file, false otherwise.
monitor - the progress monitor.
Returns:
the input stream to access the contents of the remote file.
Throws:
SystemMessageException - if an error occurs.

getOutputStream

public OutputStream getOutputStream(String remoteParent,
                                    String remoteFile,
                                    int options,
                                    IProgressMonitor monitor)
                             throws SystemMessageException
Gets the output stream to write/append to a remote file. Clients should close the output stream when done. Implementations should not return null.

Specified by:
getOutputStream in interface IRemoteFileSubSystem
Parameters:
remoteParent - the absolute path of the parent.
remoteFile - the name of the remote file.
options - bit wise or of option constants. Valid constants are IFileService.APPEND, IFileService.TEXT_MODE, and IFileService.NONE
monitor - the progress monitor.
Returns:
the input stream to access the contents of the remote file.
Throws:
SystemMessageException - if an error occurs.
Since:
3.0 uses int options argument

supportsEncodingConversion

public boolean supportsEncodingConversion()
Indicates whether this file subsystem supports code page conversion using the IFileServiceCodePageConverter mechanism. Certain extensions, such as property pages for encoding conversion can determine whether or not to display or enable themselves based on result of this call. Defers to the file service.

Specified by:
supportsEncodingConversion in interface IRemoteFileSubSystem
Returns:
whether this service supports encoding conversion
Since:
3.0

RSE
Release 3.0

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