1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

[207178] changing list APIs for file service and subsystems

This commit is contained in:
David McKnight 2007-10-31 21:03:25 +00:00
parent 46d361ca01
commit 3d2a16aeb2
24 changed files with 798 additions and 302 deletions

View file

@ -14,6 +14,7 @@
* Contributors:
* Martin Oberhuber (Wind River) - Adapted original tutorial code to Open RSE.
* Kevin Doyle (IBM) - [150492] FolderInfoPropertyPage doesn't work reliably
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package samples.ui.propertypages;
@ -200,7 +201,7 @@ public class FolderInfoPropertyPage
{
try
{
IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().listFoldersAndFiles( currFolder, null);
IRemoteFile[] folders = currFolder.getParentRemoteFileSubSystem().list( currFolder, null);
if ((folders != null) && (folders.length>0))
{
for (int idx=0; !stopped && (idx<folders.length); idx++)

View file

@ -23,6 +23,7 @@
* Martin Oberhuber (Wind River) - [197025][197167] Improved wait for model complete
* Martin Oberhuber (Wind River) - [191589] fix Rename by adding putInfo() for RSE EFS, and fetch symlink info
* Martin Oberhuber (Wind River) - [199552] fix deadlock with dstore-backed efs access
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.efs;
@ -357,7 +358,7 @@ public class RSEFileStoreImpl extends FileStore
children = fileServiceSubSystem.getHostFileToRemoteFileAdapter().convertToRemoteFiles(fileServiceSubSystem, context, remoteFile, results);
}
else {
children = subSys.listFoldersAndFiles(remoteFile, "*", monitor); //$NON-NLS-1$
children = subSys.list(remoteFile, monitor);
}
names = new String[children.length];
@ -432,7 +433,7 @@ public class RSEFileStoreImpl extends FileStore
children = fileServiceSubSystem.getHostFileToRemoteFileAdapter().convertToRemoteFiles(fileServiceSubSystem, context, remoteFile, results);
}
else {
children = subSys.listFoldersAndFiles(remoteFile, "*", monitor); //$NON-NLS-1$
children = subSys.list(remoteFile, monitor);
}
infos = new FileInfo[children.length];

View file

@ -30,6 +30,7 @@
* David McKnight (IBM) - [205819] Need to use input stream copy when EFS files are the src
* David McKnight (IBM) - [195285] mount path mapper changes
* Kevin Doyle (IBM) - [203014] Copy/Paste Across Connections doesn't display Overwrite dialog when folder already exists
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.files.ui.resources;
@ -404,7 +405,7 @@ public class UniversalFileTransferUtility
tempFolder = getTempFileFor(srcFileOrFolder);
try
{
IRemoteFile[] children = srcFS.listFoldersAndFiles(srcFileOrFolder,monitor);
IRemoteFile[] children = srcFS.list(srcFileOrFolder,monitor);
SystemRemoteResourceSet childSet = new SystemRemoteResourceSet(srcFS, children);
@ -873,7 +874,7 @@ public class UniversalFileTransferUtility
IRemoteFile[] children = null;
try
{
children = srcFS.listFoldersAndFiles(srcFileOrFolder, monitor);
children = srcFS.list(srcFileOrFolder, monitor);
}
catch (SystemMessageException e)
{
@ -1054,7 +1055,9 @@ public class UniversalFileTransferUtility
SystemRemoteResourceSet existingFiles = null;
try
{
existingFiles = targetFS.getRemoteFileObjects(newFilePathList, monitor);
String[] folderAndFilePaths = (String[])newFilePathList.toArray(new String[newFilePathList.size()]);
IRemoteFile[] results = targetFS.getRemoteFileObjects(folderAndFilePaths, monitor);
existingFiles = new SystemRemoteResourceSet(targetFS, results);
}
catch (Exception e)
{
@ -1251,7 +1254,8 @@ public class UniversalFileTransferUtility
try
{
resultSet = targetFS.getRemoteFileObjects(newFilePathList, monitor);
IRemoteFile[] results = targetFS.getRemoteFileObjects((String[])newFilePathList.toArray(new String[newFilePathList.size()]), monitor);
resultSet = new SystemRemoteResourceSet(targetFS, results);
}
catch (Exception e)
{
@ -1760,7 +1764,7 @@ public class UniversalFileTransferUtility
if (!shouldExtract)
{
// check for empty dir
IRemoteFile[] children = localSS.listFiles(currentSource, monitor);
IRemoteFile[] children = localSS.list(currentSource, monitor);
if (children == null || children.length == 0)
{

View file

@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [186128][refactoring] Move IProgressMonitor last in public base classes
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Kevin Doyle (IBM) - [196588] Move Dialog doesn't show Archives
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.files.ui.actions;
@ -267,7 +268,7 @@ public class SystemCopyRemoteFileAction extends SystemBaseCopyAction
IRemoteFile newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
targetFS.createFolder(newTargetFolder, monitor);
IRemoteFile[] children = srcFS.listFoldersAndFiles(srcFileOrFolder, monitor);
IRemoteFile[] children = srcFS.list(srcFileOrFolder, monitor);
if (children != null)
{
for (int i = 0; i < children.length; i++)

View file

@ -12,6 +12,7 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.files.ui.propertypages;
@ -777,6 +778,8 @@ public class UniversalPreferencePage
super.performOk();
if (modeMappings != null)
{
IFileEditorMapping[] originalMappingArray = editorRegistry.getFileEditorMappings();
// first save the transfer mode registry
Object[] array1 = modeMappings.toArray();
SystemFileTransferModeMapping[] mappingArray1 = new SystemFileTransferModeMapping[array1.length];
@ -799,6 +802,7 @@ public class UniversalPreferencePage
((EditorRegistry)editorRegistry).setFileEditorMappings(mappingArray2);
((EditorRegistry)editorRegistry).saveAssociations();
// editorRegistry.removePropertyListener(this);
int defaultFileTransferMode = ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY;
if (defaultBinaryButton.getSelection())

View file

@ -32,6 +32,7 @@
* Kevin Doyle (IBM) - [197855] Can't Delete/Rename/Move a Read-Only File
* Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
* Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.files.ui.view;
@ -2243,7 +2244,7 @@ public class SystemViewRemoteFileAdapter
IRemoteFile newTargetFolder = targetFS.getRemoteFileObject(newPath, monitor);
targetFS.createFolder(newTargetFolder, monitor);
IRemoteFile[] children = localFS.listFoldersAndFiles(srcFileOrFolder, monitor);
IRemoteFile[] children = localFS.list(srcFileOrFolder, monitor);
if (children != null)
{
for (int i = 0; i < children.length; i++)

View file

@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.internal.importexport.files;
@ -195,7 +196,7 @@ public class UniFilePlus extends File {
public IRemoteFile[] listIRemoteFiles() {
IRemoteFile[] result = null;
try {
result = remoteFile.getParentRemoteFileSubSystem().listFoldersAndFiles(remoteFile, getNullMonitor());
result = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
} catch (SystemMessageException e) {
SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
}
@ -205,7 +206,7 @@ public class UniFilePlus extends File {
public String[] list() {
IRemoteFile[] files = null;
try {
files = remoteFile.getParentRemoteFileSubSystem().listFoldersAndFiles(remoteFile, getNullMonitor());
files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
} catch (SystemMessageException e) {
SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
}
@ -221,7 +222,7 @@ public class UniFilePlus extends File {
public String[] list(FilenameFilter filter) {
IRemoteFile[] files = null;
try {
files = remoteFile.getParentRemoteFileSubSystem().listFoldersAndFiles(remoteFile, getNullMonitor());
files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
} catch (SystemMessageException e) {
SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
}
@ -243,7 +244,7 @@ public class UniFilePlus extends File {
public File[] listFiles(FileFilter filter) {
IRemoteFile[] files = null;
try {
files = remoteFile.getParentRemoteFileSubSystem().listFoldersAndFiles(remoteFile, getNullMonitor());
files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
} catch (SystemMessageException e) {
SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
}
@ -265,7 +266,7 @@ public class UniFilePlus extends File {
public File[] listFiles(FilenameFilter filter) {
IRemoteFile[] files = null;
try {
files = remoteFile.getParentRemoteFileSubSystem().listFoldersAndFiles(remoteFile, getNullMonitor());
files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
} catch (SystemMessageException e) {
SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
}

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.command;
@ -210,7 +210,7 @@ public class OutputHandler extends Handler {
// output
// the delimiters are therefore set to "\n\r"
StringTokenizer tokenizer = new StringTokenizer(
fullOutput, "\n\r"); //$NON-NLS-1$
fullOutput, "\n\r");
int numTokens = tokenizer.countTokens();
output = new String[numTokens];
int index = 0;
@ -220,9 +220,7 @@ public class OutputHandler extends Handler {
}
String lastLine = output[index - 1];
if (!_endOfStream &&
(!fullOutput.endsWith("\n") && !fullOutput.endsWith("\r"))) //$NON-NLS-1$ //$NON-NLS-2$
if (!_endOfStream && (!fullOutput.endsWith("\n") && !fullOutput.endsWith("\r")))
{
// our last line may be cut off
byte[] lastBytes = new byte[MAX_OFFSET];
@ -252,10 +250,9 @@ public class OutputHandler extends Handler {
else
{
lastBytes[lastIndex] = (byte)c;
// check for end of line
String suffix = new String(lastBytes, 0, lastIndex + 1, encoding);
String suffix = new String(lastBytes, 0, lastIndex + 1, encoding);
int rBreak = suffix.indexOf("\r");
int nBreak = suffix.indexOf("\n");
if (nBreak != -1 || rBreak != -1)
@ -276,15 +273,15 @@ public class OutputHandler extends Handler {
return output;
}
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return output;
}
public synchronized void waitForInput() {
try {
Thread.sleep(100);

View file

@ -21,6 +21,7 @@
* Xuan Chen (IBM) - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted"
* Xuan Chen (IBM) - [190824] Incorrect result for DStore#getSeparator() function when parent is "/"
* David McKnight (IBM) - [207095] check for null datastore
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.services.dstore.files;
@ -64,6 +65,7 @@ import org.eclipse.rse.services.dstore.AbstractDStoreService;
import org.eclipse.rse.services.dstore.util.DownloadListener;
import org.eclipse.rse.services.dstore.util.FileSystemMessageUtil;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IFileServiceConstants;
import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.services.files.RemoteFileSecurityException;
@ -811,6 +813,18 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
return null;
}
}
public IHostFile[] getFileMulti(String remoteParents[], String names[], IProgressMonitor monitor)
throws SystemMessageException
{
// TODO optimize dstore version of this to do mass queries then wait for last status
List results = new ArrayList();
for (int i = 0; i < remoteParents.length; i++)
{
results.add(getFile(remoteParents[i], names[i], monitor));
}
return (IHostFile[])results.toArray(new IHostFile[results.size()]);
}
/**
* Returns what the next part of the path should be, given the current
@ -1291,21 +1305,49 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
public IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor)
public IHostFile[] list(String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor)
{
return fetch(remoteParent, fileFilter, IUniversalDataStoreConstants.C_QUERY_VIEW_FOLDERS, monitor);
String queryString = null;
switch (fileType)
{
case IFileServiceConstants.FILE_TYPE_FILES:
queryString = IUniversalDataStoreConstants.C_QUERY_VIEW_FILES;
break;
case IFileServiceConstants.FILE_TYPE_FOLDERS:
queryString = IUniversalDataStoreConstants.C_QUERY_VIEW_FOLDERS;
break;
case IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS:
default:
queryString = IUniversalDataStoreConstants.C_QUERY_VIEW_ALL;
break;
}
return fetch(remoteParent, fileFilter, queryString, monitor);
}
public IHostFile[] listMulti(String[] remoteParents,
String[] fileFilters, int fileType, IProgressMonitor monitor)
throws SystemMessageException
{
// TODO - optimize dstore implementation to do mass queries then wait for last result
List files = new ArrayList();
for (int i = 0; i < remoteParents.length; i++)
{
IHostFile[] result = list(remoteParents[i], fileFilters[i], fileType, monitor);
for (int j = 0; j < result.length; j++)
{
files.add(result[j]);
}
}
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
}
public IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor)
{
return fetch(remoteParent, fileFilter, IUniversalDataStoreConstants.C_QUERY_VIEW_FILES, monitor);
}
public IHostFile[] getFilesAndFolders(String remoteParent, String fileFilter, IProgressMonitor monitor)
{
return fetch(remoteParent, fileFilter, IUniversalDataStoreConstants.C_QUERY_VIEW_ALL, monitor);
}
protected DataElement getElementFor(String path)
{
@ -1503,4 +1545,30 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
public void setIsUnixStyle(boolean isUnixStyle) {
this.unixStyle = isUnixStyle;
}
/**
* Deprecated
*/
public IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor)
{
return fetch(remoteParent, fileFilter, IUniversalDataStoreConstants.C_QUERY_VIEW_FOLDERS, monitor);
}
/**
* Deprecated
*/
public IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor)
{
return fetch(remoteParent, fileFilter, IUniversalDataStoreConstants.C_QUERY_VIEW_FILES, monitor);
}
/**
* Deprecated
*/
public IHostFile[] getFilesAndFolders(String remoteParent, String fileFilter, IProgressMonitor monitor)
{
return fetch(remoteParent, fileFilter, IUniversalDataStoreConstants.C_QUERY_VIEW_ALL, monitor);
}
}

View file

@ -64,6 +64,7 @@
* Martin Oberhuber (Wind River) - [203500] Support encodings for FTP paths
* Javier Montalvo Orus (Symbian) - [196351] Delete a folder should do recursive Delete
* Javier Montalvo Orus (Symbian) - [187096] Drag&Drop + Copy&Paste shows error message on FTP connection
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.services.files.ftp;
@ -105,6 +106,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.AbstractFileService;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IFileServiceConstants;
import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.services.files.RemoteFileCancelledException;
import org.eclipse.rse.services.files.RemoteFileIOException;
@ -710,7 +712,7 @@ public class FTPService extends AbstractFileService implements IFileService, IFT
if (name.equals(".") || name.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
//Never return the default directory names
continue;
} else if (f.isDirectory() && fileType!=FILE_TYPE_FOLDERS) {
} else if (f.isDirectory() && fileType!=IFileServiceConstants.FILE_TYPE_FOLDERS) {
//get ALL directory names (unless looking for folders only)
results.add(f);
} else if (filematcher.matches(name)) {

View file

@ -21,6 +21,7 @@
* Martin Oberhuber (Wind River) - [199394] Allow real files/folders containing String #virtual#
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
* Kevin Doyle (IBM) - [199871] LocalFileService needs to implement getMessage()
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.internal.services.local.files;
@ -58,6 +59,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.AbstractFileService;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IFileServiceConstants;
import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.services.files.RemoteFileException;
import org.eclipse.rse.services.files.RemoteFileIOException;
@ -167,7 +169,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic
if (entry.isFile()) {
result = _matcher.matches(name);
} else if (entry.isDirectory()) {
if (type == FILE_TYPE_FILES_AND_FOLDERS || type == FILE_TYPE_FOLDERS) {
if (type == IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS || type == IFileServiceConstants.FILE_TYPE_FOLDERS) {
result = true;
}
}
@ -706,16 +708,16 @@ public class LocalFileService extends AbstractFileService implements IFileServic
File file = files[i];
if (file.isDirectory())
{
if (type == FILE_TYPE_FILES_AND_FOLDERS ||
type == FILE_TYPE_FOLDERS)
if (type == IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS ||
type == IFileServiceConstants.FILE_TYPE_FOLDERS)
{
results.add(new LocalHostFile(file));
}
}
else if (file.isFile())
{
if (type == FILE_TYPE_FILES_AND_FOLDERS ||
type == FILE_TYPE_FILES)
if (type == IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS ||
type == IFileServiceConstants.FILE_TYPE_FILES)
{
results.add(new LocalHostFile(file));
}

View file

@ -15,6 +15,7 @@
* Benjamin Muskalla (b.muskalla@gmx.net) - [174690][ssh] cannot delete symbolic links on remote systems
* Martin Oberhuber (Wind River) - [203490] Fix NPE in SftpService.getUserHome()
* Martin Oberhuber (Wind River) - [203500] Support encodings for SSH Sftp paths
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.internal.services.ssh.files;
@ -61,6 +62,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.AbstractFileService;
import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IFileServiceConstants;
import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.services.files.RemoteFileCancelledException;
import org.eclipse.rse.services.files.RemoteFileIOException;
@ -439,7 +441,7 @@ public class SftpFileService extends AbstractFileService implements IFileService
//don't show the trivial names
continue;
}
if (filematcher.matches(fileName) || (lsEntry.getAttrs().isDir() && fileType!=FILE_TYPE_FOLDERS)) {
if (filematcher.matches(fileName) || (lsEntry.getAttrs().isDir() && fileType!=IFileServiceConstants.FILE_TYPE_FOLDERS)) {
//get ALL directory names (unless looking for folders only)
SftpHostFile node = makeHostFile(parentPath, fileName, lsEntry.getAttrs());
if (isRightType(fileType, node)) {

View file

@ -12,12 +12,15 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.services.files;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
@ -28,35 +31,49 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
public abstract class AbstractFileService implements IFileService
{
public static final int FILE_TYPE_FILES_AND_FOLDERS = 0;
public static final int FILE_TYPE_FILES = 1;
public static final int FILE_TYPE_FOLDERS = 2;
public IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(remoteParent, fileFilter, FILE_TYPE_FILES, monitor);
}
public IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(remoteParent, fileFilter, FILE_TYPE_FOLDERS, monitor);
}
public IHostFile[] getFilesAndFolders(String parentPath, String fileFilter, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(parentPath, fileFilter, FILE_TYPE_FILES_AND_FOLDERS, monitor);
}
protected abstract IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
public IHostFile[] getFileMulti(String remoteParents[], String names[], IProgressMonitor monitor)
throws SystemMessageException
{
List results = new ArrayList();
for (int i = 0; i < remoteParents.length; i++)
{
results.add(getFile(remoteParents[i], names[i], monitor));
}
return (IHostFile[])results.toArray(new IHostFile[results.size()]);
}
public IHostFile[] list(String remoteParent, String fileFilter,
int fileType, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(remoteParent, fileFilter, fileType, monitor);
}
public IHostFile[] listMulti(String[] remoteParents,
String[] fileFilters, int fileType, IProgressMonitor monitor)
throws SystemMessageException {
List files = new ArrayList();
for (int i = 0; i < remoteParents.length; i++)
{
IHostFile[] result = list(remoteParents[i], fileFilters[i], fileType, monitor);
for (int j = 0; j < result.length; j++)
{
files.add(result[j]);
}
}
return (IHostFile[])files.toArray(new IHostFile[files.size()]);
}
protected boolean isRightType(int fileType, IHostFile node)
{
switch (fileType)
{
case FILE_TYPE_FILES_AND_FOLDERS:
case IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS:
return true;
case FILE_TYPE_FILES:
case IFileServiceConstants.FILE_TYPE_FILES:
if (node.isFile())
{
return true;
@ -65,7 +82,7 @@ public abstract class AbstractFileService implements IFileService
{
return false;
}
case FILE_TYPE_FOLDERS:
case IFileServiceConstants.FILE_TYPE_FOLDERS:
if (node.isDirectory())
{
return true;
@ -76,7 +93,7 @@ public abstract class AbstractFileService implements IFileService
}
default:
return true;
}
}
}
/**
@ -121,4 +138,28 @@ public abstract class AbstractFileService implements IFileService
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException {
return null;
}
/**
* @deprecated
*/
public IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(remoteParent, fileFilter, IFileServiceConstants.FILE_TYPE_FILES, monitor);
}
/**
* @deprecated
*/
public IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(remoteParent, fileFilter, IFileServiceConstants.FILE_TYPE_FOLDERS, monitor);
}
/**
* @deprecated
*/
public IHostFile[] getFilesAndFolders(String parentPath, String fileFilter, IProgressMonitor monitor) throws SystemMessageException
{
return internalFetch(parentPath, fileFilter, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
}
}

View file

@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
* Martin Oberhuber (Wind River) - [204710] Update Javadoc to mention that getUserHome() may return null
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.services.files;
@ -105,45 +106,54 @@ public interface IFileService extends IService
*/
public IHostFile getFile(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException;
/**
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param 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.
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*
*/
public IHostFile[] getFilesAndFolders(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException;
public IHostFile[] list(String remoteParent, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param 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.
* @param remoteParents - the list of remote parents
* @param names - the list of file names
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @return the host files given the parent paths and file names. This is basically a batch version of getFile().
* Must not return <code>null</code>, non-existing files should be
* reported with an IHostFile object where {@link IHostFile#exists()}
* returns <code>false</code>.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*/
public IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException;
public IHostFile[] getFileMulti(String remoteParents[], String names[], IProgressMonitor monitor) throws SystemMessageException;
/**
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param fileFilter - a string that can be used to filter the children. Only
* those files matching the filter make it into the list. The interface
* @param remoteParents - the names of the parent directories on the remote file
* system from which to retrieve the collective child list.
* @param 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.
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @return the collective list of host files that reside in each of the remoteParents with it's corresponding filter.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*/
public IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException;
public IHostFile[] listMulti(String[] remoteParents, String[] fileFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* @param monitor the monitor for this potentially long running operation
* Return the list of roots for this system
@ -336,4 +346,51 @@ public interface IFileService extends IService
* @since 2.0
*/
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException;
/**
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param 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.
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*
* @deprecated use list
*/
public IHostFile[] getFilesAndFolders(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param 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.
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*
* @deprecated use list
*/
public IHostFile[] getFiles(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* @param remoteParent - the name of the parent directory on the remote file
* system from which to retrieve the child list.
* @param 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.
* @param monitor the monitor for this potentially long running operation
* @return the list of host files.
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
*
* @deprecated use list
*/
public IHostFile[] getFolders(String remoteParent, String fileFilter, IProgressMonitor monitor) throws SystemMessageException;
}

View file

@ -0,0 +1,22 @@
/********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: David McKnight.
*
* Contributors:
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.services.files;
public interface IFileServiceConstants {
public static final int FILE_TYPE_FILES = 1;
public static final int FILE_TYPE_FILES_AND_FOLDERS = 0;
public static final int FILE_TYPE_FOLDERS = 2;
}

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - fix 158766: content assist works 1st time only
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
* Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.shells.ui.view;
@ -36,6 +37,7 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
import org.eclipse.rse.core.subsystems.RemoteChildrenContentsType;
import org.eclipse.rse.internal.shells.ui.ShellsUIPlugin;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.IFileServiceConstants;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
@ -512,7 +514,7 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
}
else
{
fileList = parent.getParentRemoteFileSubSystem().listFoldersAndFiles(parent, currentText + "*", monitor); //$NON-NLS-1$
fileList = parent.getParentRemoteFileSubSystem().list(parent, currentText + "*", IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor); //$NON-NLS-1$
}
@ -569,7 +571,7 @@ public class CommandEntryContentAssistProcessor implements IContentAssistProcess
{
try
{
fileList = workingDirectory.getParentRemoteFileSubSystem().listFoldersAndFiles(workingDirectory, filterString, null);
fileList = workingDirectory.getParentRemoteFileSubSystem().list(workingDirectory, filterString, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor());
}
catch (SystemMessageException e)
{

View file

@ -21,6 +21,7 @@
* Javier Montalvo Orus (Symbian) - [199773] Default file transfer mode is ignored for some file types
* David McKnight (IBM) - [207095] Implicit connect on getRemoteFileObject
* David McKnight (IBM) - [207100] fire event after upload and download
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.subsystems.files.core.servicesubsystem;
@ -28,6 +29,8 @@ package org.eclipse.rse.subsystems.files.core.servicesubsystem;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
@ -56,6 +59,7 @@ import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistr
import org.eclipse.rse.subsystems.files.core.subsystems.IHostFileToRemoteFileAdapter;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileContext;
import org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
@ -63,6 +67,7 @@ import org.eclipse.rse.ui.SystemBasePlugin;
public final class FileServiceSubSystem extends RemoteFileSubSystem implements IFileServiceSubSystem
{
protected ILanguageUtilityFactory _languageUtilityFactory;
protected IFileService _hostFileService;
protected ISearchService _hostSearchService;
@ -153,6 +158,8 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
return getHostFileToRemoteFileAdapter().convertToRemoteFile(this, getDefaultContext(), parent, node);
}
/**
* Constructs and returns an IRemoteFile object given a fully-qualified
* file or folder name.
@ -304,21 +311,12 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
_userHome = root;
return root;
}
protected IHostFile[] getFolders(String parentPath, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
protected IHostFile[] internalList(String parentPath, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException
{
return getFileService().getFolders(parentPath, fileNameFilter, monitor);
return getFileService().list(parentPath, fileNameFilter, fileType, monitor);
}
protected IHostFile[] getFiles(String parentPath, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return getFileService().getFiles(parentPath, fileNameFilter, monitor);
}
protected IHostFile[] getFilesAndFolders(String parentPath, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return getFileService().getFilesAndFolders(parentPath, fileNameFilter, monitor);
}
protected IHostFile getFile(String parentPath, String fileName, IProgressMonitor monitor) throws SystemMessageException
{
@ -330,6 +328,91 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
return getFileService().getRoots(monitor);
}
public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames,
IProgressMonitor monitor) throws SystemMessageException
{
String[] parentPaths = new String[folderOrFileNames.length];
String[] names = new String[folderOrFileNames.length];
String sep = null;
for (int i = 0; i < folderOrFileNames.length; i++)
{
String fofName = folderOrFileNames[i];
if (sep == null)
sep = PathUtility.getSeparator(fofName);
String parentPath = null;
String name = null;
int lastSep = fofName.lastIndexOf(sep);
if (lastSep > -1)
{
parentPath = fofName.substring(0, lastSep);
if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$
name = fofName.substring(lastSep + 1, fofName.length());
}
parentPaths[i] = parentPath;
names[i] = name;
}
RemoteFileContext context = getDefaultContext();
IHostFile[] nodes = getFileService().getFileMulti(parentPaths, names, monitor);
return getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, nodes);
}
/**
* Return a list of remote folders and files in the given folder. Only file names are subsettable
* by the given file name filter. It can be null for no subsetting.
* @param parents The parent folders to list folders and files in
* @param fileNameFilters The name patterns to subset the file list by, or null to return all files.
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] listMulti(IRemoteFile[] parents, String[] fileNameFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException
{
String[] parentPaths = new String[parents.length];
for (int i = 0; i < parents.length; i++)
{
parentPaths[i] = parents[i].getAbsolutePath();
}
IHostFile[] results = getFileService().listMulti(parentPaths, fileNameFilters, fileType, monitor);
RemoteFileContext context = getDefaultContext();
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, results);
// caching
for (int i = 0; i < parents.length; i++)
{
IRemoteFile parent = parents[i];
String parentPath = parentPaths[i];
String filter = fileNameFilters[i];
List underParent = new ArrayList();
// what files are under this one?
for (int j = 0; j < farr.length; j++)
{
IRemoteFile child = farr[j];
String childParentPath = child.getParentPath();
if (parentPath.equals(childParentPath))
{
underParent.add(child);
}
}
if (underParent.size() > 0)
{
parent.setContents(RemoteChildrenContentsType.getInstance(), filter, underParent.toArray());
}
}
return farr;
}
/**
* Return a list of remote folders and files in the given folder.
* <p>
@ -339,8 +422,10 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param context The holder of state information
* @param fileType the type of file to query
* @param monitor the progress monitor
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException
public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, int fileType, IProgressMonitor monitor) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
@ -355,7 +440,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
throw new SystemMessageException(msg);
}
IHostFile[] results = getFilesAndFolders(parentPath, fileNameFilter, monitor);
IHostFile[] results = internalList(parentPath, fileNameFilter, fileType, monitor);
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null)
@ -363,82 +448,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
return farr;
}
/**
* Return the array of IRemoteFile instances, matching the given pattern,
* that are contained in the given folder.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param context The holder of state information
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context,IProgressMonitor monitor) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
parentPath = parent.getAbsolutePath();
} else {
parentPath = "/"; //$NON-NLS-1$
}
if (parent != null && !parent.canRead())
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_UNREADABLE).makeSubstitution(parentPath);
throw new SystemMessageException(msg);
}
IHostFile[] results = null;
try
{
results = getFiles(parentPath, fileNameFilter, monitor);
}
catch (SystemMessageException e)
{
}
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null)
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
return farr;
}
/**
* Return a subsetted list of remote folders in the given parent folder on the remote system.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param context The holder of state information
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
parentPath = parent.getAbsolutePath();
} else {
parentPath = "/"; //$NON-NLS-1$
}
if (parent != null && !parent.canRead())
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_UNREADABLE).makeSubstitution(parentPath);
throw new SystemMessageException(msg);
}
IHostFile[] results = null;
try
{
results = getFolders(parentPath, fileNameFilter, monitor);
}
catch (SystemMessageException e)
{
}
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null)
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
return farr;
}
public IRemoteFile[] listRoots(IRemoteFileContext context, IProgressMonitor monitor) throws InterruptedException
{
@ -830,6 +840,146 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
* @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#getOutputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor)
*/
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException {
return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this);
return new FileSubSystemOutputStream(getFileService().getOutputStream(remoteParent, remoteFile, isBinary, monitor), remoteParent, remoteFile, this);
}
/**
* Return the array of IRemoteFile instances, matching the given pattern,
* that are contained in the given folder.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param context The holder of state information
*
* @deprecated use list
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context,IProgressMonitor monitor) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
parentPath = parent.getAbsolutePath();
} else {
parentPath = "/"; //$NON-NLS-1$
}
if (parent != null && !parent.canRead())
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_UNREADABLE).makeSubstitution(parentPath);
throw new SystemMessageException(msg);
}
IHostFile[] results = null;
try
{
results = getFiles(parentPath, fileNameFilter, monitor);
}
catch (SystemMessageException e)
{
}
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null)
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
return farr;
}
/**
* Return a subsetted list of remote folders in the given parent folder on the remote system.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param context The holder of state information
*
* @deprecated use list
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
parentPath = parent.getAbsolutePath();
} else {
parentPath = "/"; //$NON-NLS-1$
}
if (parent != null && !parent.canRead())
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_UNREADABLE).makeSubstitution(parentPath);
throw new SystemMessageException(msg);
}
IHostFile[] results = null;
try
{
results = getFolders(parentPath, fileNameFilter, monitor);
}
catch (SystemMessageException e)
{
}
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null)
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
return farr;
}
/**
* Return a list of remote folders and files in the given folder.
* <p>
* The files part of the list is subsetted by the given file name filter.
* It can be null for no subsetting.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s).
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param context The holder of state information
*
* @deprecated use list
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException
{
String parentPath = null;
if (parent != null) {
parentPath = parent.getAbsolutePath();
} else {
parentPath = "/"; //$NON-NLS-1$
}
if (parent != null && !parent.canRead())
{
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_FOLDER_UNREADABLE).makeSubstitution(parentPath);
throw new SystemMessageException(msg);
}
IHostFile[] results = getFilesAndFolders(parentPath, fileNameFilter, monitor);
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
if (parent != null)
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
return farr;
}
/**
* @deprecated
*/
protected IHostFile[] getFolders(String parentPath, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return getFileService().getFolders(parentPath, fileNameFilter, monitor);
}
/**
* @deprecated
*/
protected IHostFile[] getFiles(String parentPath, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return getFileService().getFiles(parentPath, fileNameFilter, monitor);
}
/**
* @deprecated
*/
protected IHostFile[] getFilesAndFolders(String parentPath, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return getFileService().getFilesAndFolders(parentPath, fileNameFilter, monitor);
}
}

View file

@ -15,6 +15,7 @@
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.subsystems.files.core.subsystems;
@ -22,10 +23,8 @@ package org.eclipse.rse.subsystems.files.core.subsystems;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetAddress;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.rse.core.model.SystemRemoteResourceSet;
import org.eclipse.rse.core.subsystems.ISubSystem;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.RemoteFileException;
@ -106,51 +105,51 @@ public interface IRemoteFileSubSystem extends ISubSystem {
* This version is called directly by users.
*/
public IRemoteFile[] listRoots(IProgressMonitor monitor) throws InterruptedException, SystemMessageException;
/**
* Return a list of all remote folders in the given parent folder on the remote system
* @param parent The parent folder to list folders in
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parents The parent folders to list folders and files in
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
public IRemoteFile[] listMulti(IRemoteFile[] parents, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder. Only file names are subsettable
* by the given file name filter. It can be null for no subsetting.
* @param parents The parent folders to list folders and files in
* @param fileNameFilters The name patterns to subset the file list by, or null to return all files.
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] listMulti(IRemoteFile[] parents, String[] fileNameFilters, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a full list of remote folders in the given parent folder on the remote system.
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param monitor the progress monitor
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote files in the given parent folder on the remote system
* @param parent The parent folder to list files in
* @param monitor the progress monitor
*/
public IRemoteFile[] listFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param monitor the progress monitor
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
* @param monitor the progress monitor
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
public IRemoteFile[] list(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] list(IRemoteFile parent, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder. Only file names are subsettable
* by the given file name filter. It can be null for no subsetting.
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException;
public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder.
@ -161,31 +160,14 @@ public interface IRemoteFileSubSystem extends ISubSystem {
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param context The holder of state information
* - indicates whether to query files, folders, both or some other type
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a subsetted list of remote folders in the given parent folder on the remote system.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* <b>note</b>This method should be abstract but MOF doesn't allow abstract impl classes at this point
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param context The holder of state information
* @param monitor the progress monitor
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException;
public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, int fileType, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* <b>note</b>This method should be abstract but MOF doesn't allow abstract impl classes at this point
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param context The holder of state information
* @param monitor the progress monitor
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException;
/**
* Given a search configuration, searches for its results.
@ -243,7 +225,7 @@ public interface IRemoteFileSubSystem extends ISubSystem {
*
* @return the set of resources
*/
public SystemRemoteResourceSet getRemoteFileObjects(List folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException;
public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException;
/**
* Given a fully qualified file or folder name, return an IRemoteFile
@ -570,4 +552,105 @@ public interface IRemoteFileSubSystem extends ISubSystem {
* @since 2.0
*/
public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote folders in the given parent folder on the remote system
* @param parent The parent folder to list folders in
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a full list of remote folders in the given parent folder on the remote system.
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote files in the given parent folder on the remote system
* @param parent The parent folder to list files in
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a subsetted list of remote folders in the given parent folder on the remote system.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* <b>note</b>This method should be abstract but MOF doesn't allow abstract impl classes at this point
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded
* @param context The holder of state information
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s)
* <b>note</b>This method should be abstract but MOF doesn't allow abstract impl classes at this point
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
* @param context The holder of state information
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder. Only file names are subsettable
* by the given file name filter. It can be null for no subsetting.
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException;
/**
* Return a list of remote folders and files in the given folder.
* <p>
* The files part of the list is subsetted by the given file name filter.
* It can be null for no subsetting.
* This version is called by RemoteFileSubSystemImpl's resolveFilterString(s).
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param context The holder of state information
* @param monitor the progress monitor
*
* @deprecated use list
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IRemoteFileContext context, IProgressMonitor monitor) throws SystemMessageException;
}

View file

@ -20,6 +20,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* David McKnight (IBM) - [196664] prevent unnecessary query on the parent
* Rupen Mardirossian (IBM) - [204307] listFolders now deals with a null parameter for fileNameFilter preventing NPE
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.subsystems.files.core.subsystems;
@ -37,7 +38,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import org.eclipse.core.runtime.IPath;
@ -51,7 +51,6 @@ import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemMessageObject;
import org.eclipse.rse.core.model.SystemChildrenContentsType;
import org.eclipse.rse.core.model.SystemMessageObject;
import org.eclipse.rse.core.model.SystemRemoteResourceSet;
import org.eclipse.rse.core.subsystems.CommunicationsEvent;
import org.eclipse.rse.core.subsystems.ICommunicationsListener;
import org.eclipse.rse.core.subsystems.IConnectorService;
@ -65,6 +64,7 @@ import org.eclipse.rse.services.clientserver.IMatcher;
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.files.IFileServiceConstants;
import org.eclipse.rse.services.search.IHostSearchResult;
import org.eclipse.rse.services.search.IHostSearchResultConfiguration;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
@ -661,17 +661,17 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
else if (hasFileContents)
{
// already have the files, now add the folders
listFolders(parent, filter, monitor);
list(parent, filter, IFileServiceConstants.FILE_TYPE_FOLDERS, monitor);
}
else if (hasFolderContents)
{
// already have the folders, now add the files
listFiles(parent, filter, monitor);
list(parent, filter, IFileServiceConstants.FILE_TYPE_FILES, monitor);
}
else
{
// don't have anything - query both
listFoldersAndFiles(parent, filter, monitor);
list(parent, filter, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
}
children = parent.getContents(RemoteChildrenContentsType.getInstance(), filter);
}
@ -840,9 +840,9 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
{
if (showDirs && showFiles)
//children = listFoldersAndFiles((IRemoteFile)parent, filterString);
children = listFoldersAndFiles((IRemoteFile) parent, filterString, monitor);
children = list((IRemoteFile) parent, filterString, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
else if (showDirs)
children = listFolders((IRemoteFile) parent, filterString, monitor);
children = list((IRemoteFile) parent, filterString, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
else
children = listFiles((IRemoteFile) parent, filterString, monitor);
if (sort && (children != null) && (children.length > 1))
@ -866,69 +866,43 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
return listRoots(getDefaultContext(), monitor);
}
/**
* Return a list of all remote folders in the given parent folder on the remote system
* @param parent The parent folder to list folders in
*/
public IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
{
return listFolders(parent, null, monitor);
}
/**
* Return a full list of remote folders in the given parent folder on the remote system.
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded, or null to return all folders.
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
fileNameFilter = (fileNameFilter == null) ? "*" : fileNameFilter; //$NON-NLS-1$
RemoteFileFilterString filterString = new RemoteFileFilterString(getParentRemoteFileSubSystemConfiguration());
filterString.setPath(parent.getAbsolutePath());
filterString.setFile(fileNameFilter);
filterString.setShowFiles(false);
filterString.setShowSubDirs(true);
RemoteFileContext context = new RemoteFileContext(this, parent, filterString);
//return listFolders(parent, fileNameFilter, context);
return listFolders(parent, fileNameFilter, context, monitor);
}
/**
* Return a list of all remote files in the given parent folder on the remote system
* @param parent The parent folder to list files in
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parents The parent folders to list folders and files in
* @param fileType - indicates whether to query files, folders, both or some other type
* @param monitor the progress monitor
*/
public IRemoteFile[] listFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
public IRemoteFile[] listMulti(IRemoteFile[] parents, int fileType, IProgressMonitor monitor) throws SystemMessageException
{
return listFiles(parent, null, monitor);
String[] fileNameFilters = new String[parents.length];
for (int i = 0; i < parents.length; i++)
{
fileNameFilters[i] = "*"; // default filter //$NON-NLS-1$
}
return listMulti(parents, fileNameFilters, fileType, monitor);
}
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
fileNameFilter = (fileNameFilter == null) ? "*" : fileNameFilter; //$NON-NLS-1$
String parentPath = parent.getAbsolutePath();
IRemoteFileSubSystemConfiguration config = getParentRemoteFileSubSystemConfiguration();
RemoteFileFilterString filterString = new RemoteFileFilterString(config, parentPath, fileNameFilter);
filterString.setShowFiles(true);
filterString.setShowSubDirs(false);
RemoteFileContext context = new RemoteFileContext(this, parent, filterString);
return listFiles(parent, fileNameFilter, context, monitor);
}
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
* @param monitor the progress monitor
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
public IRemoteFile[] list(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
{
return listFoldersAndFiles(parent, (String) null, monitor);
return list(parent, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
}
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
* @param fileType the type of file
* @param monitor the monitor
*/
public IRemoteFile[] list(IRemoteFile parent, int fileType, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, (String) null, fileType, monitor);
}
/**
@ -938,8 +912,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
*
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
* @param fileType the type of file
* @param monitor the monitor
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
public IRemoteFile[] list(IRemoteFile parent, String fileNameFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException
{
String path = parent.getAbsolutePath();
fileNameFilter = (fileNameFilter == null) ? "*" : fileNameFilter; //$NON-NLS-1$
@ -948,8 +924,10 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
filterString.setShowFiles(true);
filterString.setShowSubDirs(true);
RemoteFileContext context = new RemoteFileContext(this, parent, filterString);
return listFoldersAndFiles(parent, fileNameFilter, context, monitor);
return list(parent, fileNameFilter, context, fileType, monitor);
}
/**
* Given a folder or file, return its parent folder name, fully qualified
@ -1013,14 +991,13 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
* Given a set of fully qualified file or folder names, return an ISystemResourceSet object for it.
* @param folderOrFileNames Fully qualified folder or file names
*/
public SystemRemoteResourceSet getRemoteFileObjects(List folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException
public IRemoteFile[] getRemoteFileObjects(String[] folderOrFileNames, IProgressMonitor monitor) throws SystemMessageException
{
SystemRemoteResourceSet results = new SystemRemoteResourceSet(this);
for (int i = 0; i < folderOrFileNames.size(); i++)
IRemoteFile[] results = new IRemoteFile[folderOrFileNames.length];
for (int i = 0; i < folderOrFileNames.length; i++)
{
String path = (String)folderOrFileNames.get(i);
IRemoteFile nextFile = getRemoteFileObject(path, monitor);
if (nextFile != null) results.addResource(nextFile);
String path = folderOrFileNames[i];
results[i] = getRemoteFileObject(path, monitor);
}
return results;
}
@ -1479,4 +1456,77 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi
return System.getProperty("file.encoding"); //$NON-NLS-1$
}
}
/**
* Return a list of all remote folders in the given parent folder on the remote system
* @param parent The parent folder to list folders in
*
* @deprecated use list
*/
public IRemoteFile[] listFolders(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
}
/**
* Return a full list of remote folders in the given parent folder on the remote system.
* @param parent The parent folder to list folders in
* @param fileNameFilter The name pattern for subsetting the file list when this folder is subsequently expanded, or null to return all folders.
*
* @deprecated use list
*/
public IRemoteFile[] listFolders(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, fileNameFilter, IFileServiceConstants.FILE_TYPE_FOLDERS, monitor);
}
/**
* Return a list of all remote files in the given parent folder on the remote system
* @param parent The parent folder to list files in
*
* @deprecated use list
*/
public IRemoteFile[] listFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, IFileServiceConstants.FILE_TYPE_FILES, monitor);
}
/**
* Return a list of remote files in the given folder, which match the given name pattern.
* @param parent The parent folder to list files in
* @param fileNameFilter The name pattern to subset the list by, or null to return all files.
*
* @deprecated use list
*/
public IRemoteFile[] listFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, fileNameFilter, IFileServiceConstants.FILE_TYPE_FILES, monitor);
}
/**
* Return a list of all remote folders and files in the given folder. The list is not subsetted.
* @param parent The parent folder to list folders and files in
*
* @deprecated use list
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, monitor);
}
/**
* Return a list of remote folders and files in the given folder.
* <p>
* The files part of the list is subsetted by the given file name filter. It can be null for no subsetting.
*
* @param parent The parent folder to list folders and files in
* @param fileNameFilter The name pattern to subset the file list by, or null to return all files.
*
* @deprecated use list
*/
public IRemoteFile[] listFoldersAndFiles(IRemoteFile parent, String fileNameFilter, IProgressMonitor monitor) throws SystemMessageException
{
return list(parent, fileNameFilter, IFileServiceConstants.FILE_TYPE_FILES_AND_FOLDERS, monitor);
}
}

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.subsystems.files.core.util;
@ -82,7 +82,7 @@ public class ValidatorFileUniqueName
);
try
{
IRemoteFile[] contents = parentFolder.getParentRemoteFileSubSystem().listFoldersAndFiles(parentFolder, null);
IRemoteFile[] contents = parentFolder.getParentRemoteFileSubSystem().list(parentFolder, null);
if (contents!=null)
{
String[] names = new String[contents.length];

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.dstore;
@ -121,4 +121,7 @@ public class DStoreFileAdapter implements IHostFileToRemoteFileAdapter
return null;
}
}
}

View file

@ -16,6 +16,7 @@
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Kevin Doyle (IBM) - [190010] Added cancel() method that will call the search service to cancel
* David McKnight (IBM) - [190010] performance improvement to use caching for dstore search
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.dstore;
@ -102,7 +103,7 @@ public class DStoreFileSubSystemSearchResultConfiguration extends DStoreSearchRe
if (parentRemoteFile != null && !parentRemoteFile.hasContents(RemoteChildrenContentsType.getInstance()))
{
// query all files to save time (so we can retrieve cached files
IRemoteFile[] children = _fileSubSystem.listFoldersAndFiles(parentRemoteFile, monitor);
IRemoteFile[] children = _fileSubSystem.list(parentRemoteFile, monitor);
for (int c = 0; c < children.length; c++)
{
if (!children[c].isFile())

View file

@ -12,7 +12,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
* {Name} (company) - description of contribution.
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
*******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.ftp.model;
@ -43,7 +43,8 @@ public class FTPFileAdapter implements IHostFileToRemoteFileAdapter
}
return (IRemoteFile[])results.toArray(new IRemoteFile[results.size()]);
}
public IRemoteFile convertToRemoteFile(FileServiceSubSystem ss, IRemoteFileContext context, IRemoteFile parent, String name, boolean isDirectory, boolean isRoot)
{
return null;

View file

@ -10,6 +10,7 @@
* Uwe Stieber (Wind River) - refactoring and cleanup.
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Xuan Chen (IBM) - [198859] Update the API doc for getRemoteSystemConnection.
* David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
********************************************************************************/
package org.eclipse.rse.tests.core.connection;
@ -106,7 +107,8 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, systemAddress); //$NON-NLS-1$
properties.setProperty(IRSEConnectionProperties.ATTR_NAME, systemName); //$NON-NLS-1$
properties.setProperty(IRSEConnectionProperties.ATTR_USERID, userID); //$NON-NLS-1$
properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, password); //$NON-NLS-1$
if (password != null)
properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, password); //$NON-NLS-1$
IRSEConnectionProperties remoteSystemConnectionProperties;
remoteSystemConnectionProperties = getConnectionManager().loadConnectionProperties(properties, false);