|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IFileService
A IFileService is an abstraction of a file service that runs over some sort of connection. It can be shared among multiple instances of a subsystem. At some point this file service layer may become official API but for now it is experimental. Each subsystem is currently responsible for layering an abstraction over whatever it wants to construct as a service.
This is a very bare bones definition. A real definition would probably have changed terminology, use URI's rather than Strings, and have much more robust error handling.
Implementers of this interface will have to either be instantiated, initialized, or somehow derive a connection as part of its state.
Field Summary | |
---|---|
static int |
APPEND
Options constant (value 1 <<0) for specifying a stream that will append data to a file. |
static int |
FILE_TYPE_FILES
Query constant (bit mask value 1) which indicates that a query should be on files. |
static int |
FILE_TYPE_FILES_AND_FOLDERS
Query constant (bit mask value 0) which indicates that a query should produce folders and files. |
static int |
FILE_TYPE_FOLDERS
Query constant (bit mask value 2) which indicates that a query should be on folders. |
static int |
NONE
Options constant (value 0) to indicate that no bit options are set. |
static int |
TEXT_MODE
Options constant (value 2 <<0) for specifying that a file is Text instead of the default Binary. |
Method Summary | |
---|---|
void |
copy(String srcParent,
String srcName,
String tgtParent,
String tgtName,
IProgressMonitor monitor)
Copy the file or folder to the specified destination. |
void |
copyBatch(String[] srcParents,
String[] srcNames,
String tgtParent,
IProgressMonitor monitor)
Copy a set of files or folders to the specified destination. |
IHostFile |
createFile(String remoteParent,
String fileName,
IProgressMonitor monitor)
Create a file on the host. |
IHostFile |
createFolder(String remoteParent,
String folderName,
IProgressMonitor monitor)
Create a folder on the host. |
void |
delete(String remoteParent,
String fileName,
IProgressMonitor monitor)
Delete a file or folder on the host. |
void |
deleteBatch(String[] remoteParents,
String[] fileNames,
IProgressMonitor monitor)
Delete a set of files or folders on the host. |
void |
download(String remoteParent,
String remoteFile,
File localFile,
boolean isBinary,
String hostEncoding,
IProgressMonitor monitor)
Copy a file from the remote file system to the local system. |
void |
downloadMultiple(String[] remoteParents,
String[] remoteFiles,
File[] localFiles,
boolean[] isBinary,
String[] hostEncodings,
IProgressMonitor monitor)
Copy files from the remote file system to the local system. |
String |
getEncoding(IProgressMonitor monitor)
Gets the remote encoding. |
IHostFile |
getFile(String remoteParent,
String name,
IProgressMonitor monitor)
Get an abstract remote file handle for a specified path. |
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)
Get the input stream to access the contents a remote file. |
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)
Get the output stream to write/append to a remote file. |
IHostFile[] |
getRoots(IProgressMonitor monitor)
Get abstract remote file handles for the known remote file system roots. |
IHostFile |
getUserHome()
Return the user's home directory on this connection. |
boolean |
isCaseSensitive()
Indicates whether the file system is case sensitive. |
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. |
void |
move(String srcParent,
String srcName,
String tgtParent,
String tgtName,
IProgressMonitor monitor)
Move the file or folder specified to a different remote path. |
void |
rename(String remoteParent,
String oldName,
String newName,
IHostFile oldFile,
IProgressMonitor monitor)
Rename a file or folder on the host. |
void |
rename(String remoteParent,
String oldName,
String newName,
IProgressMonitor monitor)
Rename a file or folder on the host. |
void |
setLastModified(String parent,
String name,
long timestamp,
IProgressMonitor monitor)
Set the last modified stamp of the file or folder with the specified timestamp. |
void |
setReadOnly(String parent,
String name,
boolean readOnly,
IProgressMonitor monitor)
Set the read-only permission of the specified file or folder. |
boolean |
supportsEncodingConversion()
Indicates whether this file service supports code page conversion using the IFileServiceCodePageConverter mechanism. |
void |
upload(File localFile,
String remoteParent,
String remoteFile,
boolean isBinary,
String srcEncoding,
String hostEncoding,
IProgressMonitor monitor)
Copy a file to the remote file system. |
void |
upload(InputStream stream,
String remoteParent,
String remoteFile,
boolean isBinary,
String hostEncoding,
IProgressMonitor monitor)
Copy a file to the remote file system. |
void |
uploadMultiple(File[] localFiles,
String[] remoteParents,
String[] remoteFiles,
boolean[] isBinary,
String[] srcEncodings,
String[] hostEncodings,
IProgressMonitor monitor)
Copy files to the remote file system. |
Methods inherited from interface org.eclipse.rse.services.IService |
---|
getDescription, getName, initService, uninitService |
Methods inherited from interface org.eclipse.core.runtime.IAdaptable |
---|
getAdapter |
Field Detail |
---|
static final int FILE_TYPE_FILES
list(String,String,int,IProgressMonitor)
,
listMultiple(String[],String[],int,List,IProgressMonitor)
,
listMultiple(String[],String[],int[],List,IProgressMonitor)
,
Constant Field Valuesstatic final int FILE_TYPE_FOLDERS
list(String,String,int,IProgressMonitor)
,
listMultiple(String[],String[],int,List,IProgressMonitor)
,
listMultiple(String[],String[],int[],List,IProgressMonitor)
,
Constant Field Valuesstatic final int FILE_TYPE_FILES_AND_FOLDERS
list(String,String,int,IProgressMonitor)
,
listMultiple(String[],String[],int,List,IProgressMonitor)
,
listMultiple(String[],String[],int[],List,IProgressMonitor)
,
Constant Field Valuesstatic final int APPEND
getOutputStream(String, String, int, IProgressMonitor)
,
Constant Field Valuesstatic final int TEXT_MODE
getOutputStream(String, String, int, IProgressMonitor)
,
Constant Field Valuesstatic final int NONE
Method Detail |
---|
void upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
stream
- input stream to transferremoteParent
- - a string designating the parent folder of the target for this file.remoteFile
- - a string designating the name of the file to be written on the remote system.isBinary
- - indicates whether the file is text or binaryhostEncoding
- - the tgt encoding of the file (if text)monitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs.
Typically this would be one of those in the RemoteFileException family.void upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
localFile
- - a real file in the local file system.remoteParent
- - a string designating the parent folder of the target for this file.remoteFile
- - a string designating the name of the file to be written on the remote system.isBinary
- - indicates whether the file is text or binarysrcEncoding
- - the src encoding of the file (if text)hostEncoding
- - the tgt encoding of the file (if text)monitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs.
Typically this would be one of those in the
RemoteFileException
family.void uploadMultiple(File[] localFiles, String[] remoteParents, String[] remoteFiles, boolean[] isBinary, String[] srcEncodings, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException
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.
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.isBinary
- - indicates whether the files are text or binarysrcEncodings
- - 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
SystemMessageException
- if an error occurs.
Typically this would be one of those in the
RemoteFileException
family.void download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- - a String designating the remote parent.remoteFile
- - a String designating the remote file residing in the parents.localFile
- - The file that is to be written. If the file exists it is
overwritten.isBinary
- - indicates whether the file is text on binaryhostEncoding
- - the encoding on the host (if text)monitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs.
Typically this would be one of those in the
RemoteFileException
family.void downloadMultiple(String[] remoteParents, String[] remoteFiles, File[] localFiles, boolean[] isBinary, String[] hostEncodings, IProgressMonitor monitor) throws SystemMessageException
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.
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.isBinary
- - indicates whether the files are text on binaryhostEncodings
- - the encodings on the host (if text)monitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException
family.IHostFile getFile(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the name of the parent directory on the remote file
system from which to retrieve the file.name
- the name of the file to be retrieved.monitor
- the monitor for this potentially long running operation
null
, non-existing files should be
reported with an IHostFile object where
IHostFile.exists()
returns false
.
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.IHostFile[] list(String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException
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 typemonitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. Exceptions
are particularly expected when the remoteParent does not
exist, or is not a folder.void getFileMultiple(String[] remoteParents, String[] names, List hostFiles, IProgressMonitor monitor) throws SystemMessageException
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.
remoteParents
- - the list of remote parentsnames
- - the list of file nameshostFiles
- a list to which the retrieved IHostFile
objects will be appendedmonitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void listMultiple(String[] remoteParents, String[] fileFilters, int[] fileTypes, List hostFiles, IProgressMonitor monitor) throws SystemMessageException
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.
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 appendedmonitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. Exceptions
are particularly expected when a remoteParent does not exist,
or is not a folder.void listMultiple(String[] remoteParents, String[] fileFilters, int fileType, List hostFiles, IProgressMonitor monitor) throws SystemMessageException
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.
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 appendedmonitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family. Exceptions
are particularly expected when a remoteParent does not exist,
or is not a folder.IHostFile[] getRoots(IProgressMonitor monitor) throws SystemMessageException
monitor
- the monitor for this potentially long running operation
Return the list of roots for this system
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.IHostFile getUserHome()
null
if the home directory could
not be determined (for instance, because the connection is not yet connected).
In this case, clients are encouraged to query the home directory again once
the connection is connected.
null
if the home directory could not be determined.IHostFile createFile(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the parent directoryfileName
- the name of the new filemonitor
- the monitor for this potentially long running operation
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.IHostFile createFolder(String remoteParent, String folderName, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the parent directoryfolderName
- the name of the new foldermonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the folder containing the file to deletefileName
- the name of the file or folder to deletemonitor
- the progress monitor
SystemMessageException
- if an error occurs or the user canceled
the operation. SystemElementNotFoundException is thrown if the remote
file doesn't exist.void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException
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.
remoteParents
- the array of folders containing the files to deletefileNames
- the names of the files or folders to deletemonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the folder containing the file to renameoldName
- the old name of the file or folder to renamenewName
- the new name for the filemonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the folder containing the file to renameoldName
- the old name of the file or folder to renamenewName
- the new name for the fileoldFile
- the file to update with the changemonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
srcParent
- the folder containing the file or folder to movesrcName
- the new of the file or folder to movetgtParent
- the destination folder for the movetgtName
- the name of the moved file or foldermonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException
srcParent
- the folder containing the file or folder to copysrcName
- the new of the file or folder to copytgtParent
- the destination folder for the copytgtName
- the name of the copied file or foldermonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
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.
srcParents
- the folders containing each file or folder to copysrcNames
- the names of the files or folders to copytgtParent
- the destination folder for the copymonitor
- the progress monitor
SystemMessageException
- if an error occurs. Typically this would
be one of those in the RemoteFileException family.boolean isCaseSensitive()
void setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException
IHostFile.getModifiedDate()
method after a following
getFile(String, String, IProgressMonitor)
call returns exactly
the same timestamp.
parent
- the parent path of the file to setname
- the name of the file to settimestamp
- the new timestamp in milliseconds from January 1, 1970,
00:00:00 UTC.monitor
- the progress monitor
SystemMessageException
IHostFile.getModifiedDate()
void setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException
parent
- the parent path of the file to setname
- the name of the file to setreadOnly
- indicates whether to make the file read-only or
read-writemonitor
- the progress monitor
SystemMessageException
String getEncoding(IProgressMonitor monitor) throws SystemMessageException
monitor
- the progress monitor.
SystemMessageException
- if an error occurs.InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException
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. Only used for the process of opening
the Stream. Implementations are not expected to use or update
the monitor for actual Stream transfer operations.
SystemMessageException
- if an error occurs.OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException
getOutputStream(String, String, int, IProgressMonitor)
instead
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. Only used for the process of opening
the Stream. Implementations are not expected to use or update
the monitor for actual Stream transfer operations.
SystemMessageException
- if an error occurs.OutputStream getOutputStream(String remoteParent, String remoteFile, int options, IProgressMonitor monitor) throws SystemMessageException
remoteParent
- the absolute path of the parent.remoteFile
- the name of the remote file.options
- bit wise or of option constants. Valid constants are
APPEND
, TEXT_MODE
,
and NONE
monitor
- the progress monitor. Only used for the process of opening
the Stream. Implementations are not expected to use or update
the monitor for actual Stream transfer operations.
SystemMessageException
- if an error occurs.boolean supportsEncodingConversion()
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |