diff --git a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java index 7f54344bb04..f56cd147963 100644 --- a/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java +++ b/rse/examples/org.eclipse.rse.examples.tutorial/src/samples/ui/propertypages/FolderInfoPropertyPage.java @@ -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 && (idxnull, non-existing files should be + * reported with an IHostFile object where {@link IHostFile#exists()} + * returns false. * @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; + + } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileServiceConstants.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileServiceConstants.java new file mode 100644 index 00000000000..894d784e0b6 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileServiceConstants.java @@ -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; + +} diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/CommandEntryContentAssistProcessor.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/CommandEntryContentAssistProcessor.java index 80d100d0b10..ee2a6a1b94c 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/CommandEntryContentAssistProcessor.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/view/CommandEntryContentAssistProcessor.java @@ -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) { diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java index 22cac567bf0..d47e6451e26 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java @@ -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. *

@@ -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. + *

+ * 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); } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java index b8d4a6c6170..db145a784d3 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java @@ -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) - * noteThis 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) - * noteThis 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) + * noteThis 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) + * noteThis 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. + *

+ * 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; + } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java index 926e57dbbb4..c98ab7331ca 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java @@ -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. + *

+ * 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); + } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java index 6dd2e657dbc..8f7eccf8725 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/util/ValidatorFileUniqueName.java @@ -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]; diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java index 27630f900cc..d45a9ed8de4 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileAdapter.java @@ -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; } } + + + } diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java index bb19688050c..ef7c2c43c1f 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.dstore/src/org/eclipse/rse/internal/subsystems/files/dstore/DStoreFileSubSystemSearchResultConfiguration.java @@ -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()) diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/model/FTPFileAdapter.java b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/model/FTPFileAdapter.java index 22c466aa452..56560c4fc73 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/model/FTPFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.ftp/src/org/eclipse/rse/internal/subsystems/files/ftp/model/FTPFileAdapter.java @@ -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; diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java index 32156a6ffa3..e4899a7f44b 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java @@ -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);