diff --git a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java
index b77e4c9c083..305f41345d2 100644
--- a/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java
+++ b/rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java
@@ -881,7 +881,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
}
// I think the de should be reused since getElement should find it?
- getFileMultiple(parents, names, monitor);
+ getFileMultiple(parents, names, new ArrayList(10), monitor);
}
@@ -1134,7 +1134,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
/**
* Mass query of individual files
*/
- public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor)
+ public void getFileMultiple(String remoteParents[], String names[], List hostFiles, IProgressMonitor monitor)
throws SystemMessageException
{
DataElement[] subjects = getSubjectsFor(remoteParents, names);
@@ -1148,7 +1148,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
dsQueryCommandMulti(subjects, null, queryStrings, monitor);
- return convertToHostFiles(subjects, "*"); //$NON-NLS-1$
+ IHostFile[] result = convertToHostFiles(subjects, "*"); //$NON-NLS-1$
+ hostFiles.addAll(Arrays.asList(result));
}
/**
diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java
index 97c6ebc39c0..9e7bb4e244c 100644
--- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java
+++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java
@@ -25,6 +25,7 @@
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
+ * David Dykstal (IBM) - [221211] fix IFileService API for batch operations
*******************************************************************************/
package org.eclipse.rse.services.files;
@@ -47,15 +48,13 @@ public abstract class AbstractFileService extends AbstractService implements IFi
protected abstract IHostFile[] internalFetch(String parentPath, String fileFilter, int fileType, IProgressMonitor monitor) throws SystemMessageException;
- public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor)
+ public void getFileMultiple(String remoteParents[], String names[], List hostFiles, IProgressMonitor monitor)
throws SystemMessageException
{
- List results = new ArrayList();
for (int i = 0; i < remoteParents.length; i++)
{
- results.add(getFile(remoteParents[i], names[i], monitor));
+ hostFiles.add(getFile(remoteParents[i], names[i], monitor));
}
- return (IHostFile[])results.toArray(new IHostFile[results.size()]);
}
public IHostFile[] list(String remoteParent, String fileFilter,
diff --git a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java
index 309f99038b7..7b74d646fcb 100644
--- a/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java
+++ b/rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/IFileService.java
@@ -24,6 +24,7 @@
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
* Martin Oberhuber (Wind River) - [cleanup] Fix API since tags
* David Dykstal (IBM) - [221211] clarifying javadoc on batch operations
+ * David Dykstal (IBM) - [221211] fix IFileService API for batch operations
*******************************************************************************/
package org.eclipse.rse.services.files;
@@ -154,6 +155,8 @@ public interface IFileService extends IService
* @param monitor the monitor for this potentially long running operation
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void upload(InputStream stream, String remoteParent, String remoteFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
@@ -170,6 +173,8 @@ public interface IFileService extends IService
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the
* {@link RemoteFileException} family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void upload(File localFile, String remoteParent, String remoteFile, boolean isBinary, String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
@@ -209,6 +214,8 @@ public interface IFileService extends IService
* @throws SystemMessageException if an error occurs.
* Typically this would be one of those in the
* {@link RemoteFileException} family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void download(String remoteParent, String remoteFile, File localFile, boolean isBinary, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException;
@@ -282,18 +289,14 @@ public interface IFileService extends IService
*
* @param remoteParents - the list of remote parents
* @param names - the list of file names
+ * @param hostFiles a list to which the retrieved {@link IHostFile} objects will be appended
* @param monitor the monitor for this potentially long running operation
- * @return the host files given the parent paths and file names. This is
- * basically a batch version of getFile(). Must not return
- * null
, 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.
*
* @since org.eclipse.rse.services 3.0
*/
- public IHostFile[] getFileMultiple(String remoteParents[], String names[], IProgressMonitor monitor) throws SystemMessageException;
+ public void getFileMultiple(String remoteParents[], String names[], List hostFiles, IProgressMonitor monitor) throws SystemMessageException;
/**
* List the contents of multiple remote folders.
@@ -409,6 +412,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void delete(String remoteParent, String fileName, IProgressMonitor monitor) throws SystemMessageException;
@@ -428,6 +433,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void deleteBatch(String[] remoteParents, String[] fileNames, IProgressMonitor monitor) throws SystemMessageException;
@@ -440,6 +447,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void rename(String remoteParent, String oldName, String newName, IProgressMonitor monitor) throws SystemMessageException;
@@ -453,6 +462,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void rename(String remoteParent, String oldName, String newName, IHostFile oldFile, IProgressMonitor monitor) throws SystemMessageException;
@@ -466,6 +477,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void move(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
@@ -479,6 +492,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void copy(String srcParent, String srcName, String tgtParent, String tgtName, IProgressMonitor monitor) throws SystemMessageException;
@@ -495,6 +510,8 @@ public interface IFileService extends IService
* @param monitor the progress monitor
* @throws SystemMessageException if an error occurs. Typically this would
* be one of those in the RemoteFileException family.
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException;
@@ -522,6 +539,8 @@ public interface IFileService extends IService
* 00:00:00 UTC.
* @param monitor the progress monitor
* @see IHostFile#getModifiedDate()
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException;
@@ -533,6 +552,8 @@ public interface IFileService extends IService
* @param readOnly indicates whether to make the file read-only or
* read-write
* @param monitor the progress monitor
+ *
+ * @since org.eclipse.rse.services 3.0
*/
public void setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException;
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 33ea38ef750..57214631cd3 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
@@ -35,6 +35,7 @@
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
+ * David Dykstal (IBM) - [221211] fix IFileService API for batch operations
*******************************************************************************/
package org.eclipse.rse.subsystems.files.core.servicesubsystem;
@@ -386,7 +387,10 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
}
RemoteFileContext context = getDefaultContext();
- IHostFile[] nodes = getFileService().getFileMultiple(parentPaths, names, monitor);
+ List hostFiles = new ArrayList(10);
+ getFileService().getFileMultiple(parentPaths, names, hostFiles, monitor);
+ IHostFile[] nodes = new IHostFile[hostFiles.size()];
+ hostFiles.toArray(nodes);
return getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, nodes);
}