|
|
|
|
org.eclipse.rse.services.files
Class AbstractFileService
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.rse.services.AbstractService
org.eclipse.rse.services.files.AbstractFileService
-
All Implemented Interfaces:
-
IAdaptable,
IFileService,
IService
-
public abstract class AbstractFileService
- extends
AbstractService
- implements
IFileService
Method Summary
|
void
|
deleteBatch
(
String[] remoteParents,
String[] fileNames,
IProgressMonitor monitor)
Delete a set of files or folders on the host. |
void
|
downloadMultiple
(
String[] remoteParents,
String[] remoteFiles,
File[] localFiles,
boolean[] isBinaries,
String[] hostEncodings,
IProgressMonitor monitor)
Copy files from the remote file system to the local system. Default implementation - just iterate through each file |
String
|
getEncoding
(
IProgressMonitor monitor)
Returns the local platform encoding by default. |
void
|
getFileMultiple
(
String[] remoteParents,
String[] names,
List hostFiles,
IProgressMonitor monitor)
Get multiple abstract remote file handles for an array of specified
paths. |
InputStream
|
getInputStream
(
String remoteParent,
String remoteFile,
boolean isBinary,
IProgressMonitor monitor)
The default implementation returns null . |
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. |
protected abstract
IHostFile[]
|
internalFetch
(
String parentPath,
String fileFilter,
int fileType,
IProgressMonitor monitor)
|
protected boolean
|
isRightType
(int fileType,
IHostFile node)
|
IHostFile[]
|
list
(
String remoteParent,
String fileFilter,
int fileType,
IProgressMonitor monitor)
List the contents of a remote folder. |
void
|
listMultiple
(
String[] remoteParents,
String[] fileFilters,
int[] fileTypes,
List hostFiles,
IProgressMonitor monitor)
List the contents of multiple remote folders. |
void
|
listMultiple
(
String[] remoteParents,
String[] fileFilters,
int fileType,
List hostFiles,
IProgressMonitor monitor)
List the contents of multiple remote folders. |
protected
IProgressMonitor
|
progressTick
(
IProgressMonitor monitor)
Perform a single progress tick for default multi-operations, provided
that a valid progress monitor is passed in:
Checks the monitor for cancellation and throws
SystemOperationCancelledException if it is
Creates a SubMonitor for a single progress tick on the original
monitor
|
boolean
|
supportsEncodingConversion
()
The default implementation returns false. |
void
|
uploadMultiple
(
File[] localFiles,
String[] remoteParents,
String[] remoteFiles,
boolean[] isBinaries,
String[] srcEncodings,
String[] hostEncodings,
IProgressMonitor monitor)
Copy files to the remote file system. Default implementation - just iterate through each file |
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.services.files.
IFileService
|
copy,
copyBatch,
createFile,
createFolder,
delete,
download,
getFile,
getRoots,
getUserHome,
isCaseSensitive,
move,
rename,
rename,
setLastModified,
setReadOnly,
upload,
upload
|
AbstractFileService
public AbstractFileService()
progressTick
protected
IProgressMonitor progressTick(
IProgressMonitor monitor)
throws
SystemMessageException
- Perform a single progress tick for default multi-operations, provided
that a valid progress monitor is passed in:
- Checks the monitor for cancellation and throws
SystemOperationCancelledException if it is
- Creates a SubMonitor for a single progress tick on the original
monitor
-
-
-
Parameters:
-
monitor - Progress Monitor to use
-
Returns:
- A valid progress monitor usable for a single work item. Client is
responsible for calling done() on the subMonitor when done.
-
Throws:
-
SystemOperationCancelledException
- in case the user cancelled
-
SystemMessageException
-
Since:
- 3.0
internalFetch
protected abstract
IHostFile[] internalFetch(
String parentPath,
String fileFilter,
int fileType,
IProgressMonitor monitor)
throws
SystemMessageException
-
-
-
Throws:
-
SystemMessageException
getFileMultiple
public void getFileMultiple(
String[] remoteParents,
String[] names,
List hostFiles,
IProgressMonitor monitor)
throws
SystemMessageException
- Get multiple abstract remote file handles for an array of specified
paths.
If an error occurs during the retrieval an item, this operation stops on that item and a
SystemMessageException is thrown.
Items retrieved before that item will be returned. Items to be retrieved after that item will not be retrieved.
The items on which the error occurs will not be retrieved.
-
-
Specified by:
-
getFileMultiple
in interface
IFileService
-
-
Parameters:
-
remoteParents - - the list of remote parents -
names - - the list of file names -
hostFiles - a list to which the retrieved
IHostFile objects will be appended -
monitor - the monitor for this potentially long running operation
-
Throws:
-
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. -
Since:
- 3.0
list
public
IHostFile[] list(
String remoteParent,
String fileFilter,
int fileType,
IProgressMonitor monitor)
throws
SystemMessageException
- List the contents of a remote folder.
-
-
Specified by:
-
list
in interface
IFileService
-
-
Parameters:
-
remoteParent - - the name of the parent directory on the remote file
system from which to retrieve the child list. -
fileFilter - - a string that can be used to filter the children.
Only those files matching the filter make it into the list.
The interface does not dictate where the filtering occurs. -
fileType - - indicates whether to query files, folders, both or some
other type -
monitor - the monitor for this potentially long running operation
-
Returns:
- the list of host files.
-
Throws:
-
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. -
Since:
- 3.0 using int fileTYpe
listMultiple
public void listMultiple(
String[] remoteParents,
String[] fileFilters,
int[] fileTypes,
List hostFiles,
IProgressMonitor monitor)
throws
SystemMessageException
- List the contents of multiple remote folders.
If an error occurs during the retrieval of the contents of a folder, this operation stops on that folder and a
SystemMessageException is thrown.
Items retrieved before that folder will be returned. Items in folders after that folder will not be retrieved.
The items in the folder on which the error occurs will not be returned.
-
-
Specified by:
-
listMultiple
in interface
IFileService
-
-
Parameters:
-
remoteParents - - the names of the parent directories on the remote
file system from which to retrieve the collective child list. -
fileFilters - - a set of strings that can be used to filter the
children. Only those files matching the filter corresponding
to it's remoteParent make it into the list. The interface does
not dictate where the filtering occurs. For each remoteParent,
there must be a corresponding fileFilter. -
fileTypes - - indicates whether to query files, folders, both or
some other type. For each remoteParent, there must be a
corresponding fileType. For the default list of available file
types see IFileServiceContants
-
hostFiles - a list to which the found
IHostFile objects will be appended -
monitor - the monitor for this potentially long running operation
-
Throws:
-
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. -
Since:
- 3.0
listMultiple
public void listMultiple(
String[] remoteParents,
String[] fileFilters,
int fileType,
List hostFiles,
IProgressMonitor monitor)
throws
SystemMessageException
- List the contents of multiple remote folders.
If an error occurs during the retrieval of the contents of a folder, this operation stops on that folder and a
SystemMessageException is thrown.
Items retrieved before that folder will be returned. Items in folders after that folder will not be retrieved.
The items in the folder on which the error occurs will not be returned.
-
-
Specified by:
-
listMultiple
in interface
IFileService
-
-
Parameters:
-
remoteParents - - the names of the parent directories on the remote
file system from which to retrieve the collective child list. -
fileFilters - - a set of strings that can be used to filter the
children. Only those files matching the filter corresponding
to it's remoteParent make it into the list. The interface does
not dictate where the filtering occurs. For each remoteParent,
there must be a corresponding fileFilter. -
fileType - - indicates whether to query files, folders, both or some
other type. All results will be of the specified type. For the
default list of available file types see
IFileServiceContants
-
hostFiles - a list to which the found
IHostFile objects will be appended -
monitor - the monitor for this potentially long running operation
-
Throws:
-
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. -
Since:
- 3.0
isRightType
protected boolean isRightType(int fileType,
IHostFile node)
-
-
deleteBatch
public void deleteBatch(
String[] remoteParents,
String[] fileNames,
IProgressMonitor monitor)
throws
SystemMessageException
- Delete a set of files or folders on the host. Should throw an exception
if some files and folders were deleted and others were not due to an
exception during the operation. Without an exception thrown in such
cases, views may not be refreshed correctly to account for deleted
resources.
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.
-
-
Specified by:
-
deleteBatch
in interface
IFileService
-
-
Parameters:
-
remoteParents - the array of folders containing the files to delete -
fileNames - the names of the files or folders to delete -
monitor - the progress monitor
-
Throws:
-
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. -
Since:
- 3.0 returning void
downloadMultiple
public void downloadMultiple(
String[] remoteParents,
String[] remoteFiles,
File[] localFiles,
boolean[] isBinaries,
String[] hostEncodings,
IProgressMonitor monitor)
throws
SystemMessageException
- Copy files from the remote file system to the local system.
If an error occurs during the download of a file, this operation stops on that file and a
SystemMessageException is thrown.
Files downloaded before that file will remain downloaded. Files in the list after that file will not be downloaded.
The file on which the error occurs will not be downloaded. Default implementation - just iterate through each file
-
-
Specified by:
-
downloadMultiple
in interface
IFileService
-
-
Parameters:
-
remoteParents - - string designating the remote parents. -
remoteFiles - - Strings designating the remote files residing in the
parents. -
localFiles - - The files that are to be written. If the files exists
they are overwritten. -
isBinaries - - indicates whether the files are text on binary -
hostEncodings - - the encodings on the host (if text) -
monitor - the monitor for this potentially long running operation
-
Throws:
-
SystemMessageException
- if an error occurs. Typically this would
be one of those in the
RemoteFileException family. -
Since:
- 3.0 returning void
uploadMultiple
public void uploadMultiple(
File[] localFiles,
String[] remoteParents,
String[] remoteFiles,
boolean[] isBinaries,
String[] srcEncodings,
String[] hostEncodings,
IProgressMonitor monitor)
throws
SystemMessageException
- Copy files to the remote file system. The remote target is denoted by
strings representing the parents and strings representing the files.
If an error occurs during the upload of a file, this operation stops on that file and a
SystemMessageException is thrown.
Files uploaded before that file will remain uploaded. Files in the list after that file will not be uploaded.
The file on which the error occurs will not be uploaded. Default implementation - just iterate through each file
-
-
Specified by:
-
uploadMultiple
in interface
IFileService
-
-
Parameters:
-
localFiles - - real files in the local file system. -
remoteParents - - strings designating the parent folders of the target for the files. -
remoteFiles - - strings designating the names of the files to be written on the remote system. -
isBinaries - - indicates whether the files are text or binary -
srcEncodings - - the src encodings of the files (if text) -
hostEncodings - - the tgt encodings of the files (if text) -
monitor - the monitor for this potentially long running operation
-
Throws:
-
SystemMessageException
- if an error occurs.
Typically this would be one of those in the
RemoteFileException family. -
Since:
- 3.0
getEncoding
public
String getEncoding(
IProgressMonitor monitor)
throws
SystemMessageException
- Returns the local platform encoding by default. Subclasses should override to return the actual remote encoding.
-
-
Specified by:
-
getEncoding
in interface
IFileService
-
-
Parameters:
-
monitor - the progress monitor.
-
Returns:
- the encoding.
-
Throws:
-
SystemMessageException
- if an error occurs. -
Since:
- 2.0
-
See Also:
-
IFileService.getEncoding(org.eclipse.core.runtime.IProgressMonitor)
getInputStream
public
InputStream getInputStream(
String remoteParent,
String remoteFile,
boolean isBinary,
IProgressMonitor monitor)
throws
SystemMessageException
- The default implementation returns
null . Clients can override to return an input stream to the file.
-
-
Specified by:
-
getInputStream
in interface
IFileService
-
-
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:
-
IFileService.getInputStream(String, String, boolean, 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/append to a remote file. The default
implementation returns
null . Clients can override to
return an output stream to the file.
-
-
Specified by:
-
getOutputStream
in interface
IFileService
-
-
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. The default
implementation returns
null . Clients can override to return
an output stream to the file.
-
-
Specified by:
-
getOutputStream
in interface
IFileService
-
-
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 using int options
-
See Also:
-
IFileService.getOutputStream(String, String, int, IProgressMonitor)
supportsEncodingConversion
public boolean supportsEncodingConversion()
- The default implementation returns false. Clients should override this
method if they make use of IFileServiceCodePageConverter to do conversion
during download and upload.
-
-
Specified by:
-
supportsEncodingConversion
in interface
IFileService
-
-
Returns:
- whether this service supports encoding conversion
-
Since:
- 3.0
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.
|
|
|