RSE
Release 2.0

org.eclipse.rse.services.files
Class AbstractFileService

java.lang.Object
  extended by org.eclipse.rse.services.files.AbstractFileService
All Implemented Interfaces:
IFileService, IService

public abstract class AbstractFileService
extends Object
implements IFileService


Field Summary
static int FILE_TYPE_FILES
           
static int FILE_TYPE_FILES_AND_FOLDERS
           
static int FILE_TYPE_FOLDERS
           
 
Constructor Summary
AbstractFileService()
           
 
Method Summary
 boolean deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor)
          Deletes a set of files or folders on the host.
 String getEncoding(IProgressMonitor monitor)
          Returns the local platform encoding by default.
 IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor)
           
 IHostFile[] getFilesAndFolders(String parentPath, String fileFilter, IProgressMonitor monitor)
           
 IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor)
           
 InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor)
          The default implementation returns null.
 SystemMessage getMessage(String messageID)
          Dummy impl for now
 OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor)
          The default implementation returns null.
protected abstract  IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor)
           
protected  boolean isRightType(int fileType, IHostFile node)
           
 
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
 
Methods inherited from interface org.eclipse.rse.services.IService
getDescription, getName, initService, uninitService
 

Field Detail

FILE_TYPE_FILES_AND_FOLDERS

public static final int FILE_TYPE_FILES_AND_FOLDERS
See Also:
Constant Field Values

FILE_TYPE_FILES

public static final int FILE_TYPE_FILES
See Also:
Constant Field Values

FILE_TYPE_FOLDERS

public static final int FILE_TYPE_FOLDERS
See Also:
Constant Field Values
Constructor Detail

AbstractFileService

public AbstractFileService()
Method Detail

getFiles

public IHostFile[] getFiles(String remoteParent,
                            String fileFilter,
                            IProgressMonitor monitor)
                     throws SystemMessageException
Specified by:
getFiles 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.
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.

getFolders

public IHostFile[] getFolders(String remoteParent,
                              String fileFilter,
                              IProgressMonitor monitor)
                       throws SystemMessageException
Specified by:
getFolders 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.
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.

getFilesAndFolders

public IHostFile[] getFilesAndFolders(String parentPath,
                                      String fileFilter,
                                      IProgressMonitor monitor)
                               throws SystemMessageException
Specified by:
getFilesAndFolders in interface IFileService
Parameters:
parentPath - - 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.
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.

internalFetch

protected abstract IHostFile[] internalFetch(String parentPath,
                                             String fileFilter,
                                             int fileType,
                                             IProgressMonitor monitor)
                                      throws SystemMessageException
Throws:
SystemMessageException

isRightType

protected boolean isRightType(int fileType,
                              IHostFile node)

getMessage

public SystemMessage getMessage(String messageID)
Dummy impl for now

Specified by:
getMessage in interface IService

deleteBatch

public boolean deleteBatch(String[] remoteParents,
                           String[] fileNames,
                           IProgressMonitor monitor)
                    throws SystemMessageException
Description copied from interface: IFileService
Deletes 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.

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
Returns:
true iff all deletes are successful
Throws:
SystemMessageException - if an error occurs. Typically this would be one of those in the RemoteFileException family.

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
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.
See Also:
IFileService.getOutputStream(String, String, boolean, IProgressMonitor)

RSE
Release 2.0

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