mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-19 06:05:56 +02:00
[221211] [api][breaking][files] need batch operations to indicate which operations were successful
https://bugs.eclipse.org/bugs/show_bug.cgi?id=221211
This commit is contained in:
parent
7e7d743984
commit
0f548e8386
4 changed files with 39 additions and 14 deletions
|
@ -881,7 +881,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
||||||
}
|
}
|
||||||
|
|
||||||
// I think the de should be reused since getElement should find it?
|
// 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
|
* 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
|
throws SystemMessageException
|
||||||
{
|
{
|
||||||
DataElement[] subjects = getSubjectsFor(remoteParents, names);
|
DataElement[] subjects = getSubjectsFor(remoteParents, names);
|
||||||
|
@ -1148,7 +1148,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
|
||||||
|
|
||||||
dsQueryCommandMulti(subjects, null, queryStrings, monitor);
|
dsQueryCommandMulti(subjects, null, queryStrings, monitor);
|
||||||
|
|
||||||
return convertToHostFiles(subjects, "*"); //$NON-NLS-1$
|
IHostFile[] result = convertToHostFiles(subjects, "*"); //$NON-NLS-1$
|
||||||
|
hostFiles.addAll(Arrays.asList(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
|
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
|
||||||
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
* David McKnight (IBM) - [216252] use SimpleSystemMessage instead of getMessage()
|
||||||
* Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable and add Javadoc
|
* 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;
|
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;
|
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
|
throws SystemMessageException
|
||||||
{
|
{
|
||||||
List results = new ArrayList();
|
|
||||||
for (int i = 0; i < remoteParents.length; i++)
|
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,
|
public IHostFile[] list(String remoteParent, String fileFilter,
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
|
* David McKnight (IBM) - [209704] added supportsEncodingConversion()
|
||||||
* Martin Oberhuber (Wind River) - [cleanup] Fix API since tags
|
* Martin Oberhuber (Wind River) - [cleanup] Fix API since tags
|
||||||
* David Dykstal (IBM) - [221211] clarifying javadoc on batch operations
|
* 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;
|
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
|
* @param monitor the monitor for this potentially long running operation
|
||||||
* @throws SystemMessageException if an error occurs.
|
* @throws SystemMessageException if an error occurs.
|
||||||
* Typically this would be one of those in the RemoteFileException family.
|
* 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;
|
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.
|
* @throws SystemMessageException if an error occurs.
|
||||||
* Typically this would be one of those in the
|
* Typically this would be one of those in the
|
||||||
* {@link RemoteFileException} family.
|
* {@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;
|
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.
|
* @throws SystemMessageException if an error occurs.
|
||||||
* Typically this would be one of those in the
|
* Typically this would be one of those in the
|
||||||
* {@link RemoteFileException} family.
|
* {@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;
|
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 remoteParents - the list of remote parents
|
||||||
* @param names - the list of file names
|
* @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
|
* @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
|
|
||||||
* <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
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* be one of those in the RemoteFileException family.
|
||||||
*
|
*
|
||||||
* @since org.eclipse.rse.services 3.0
|
* @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.
|
* List the contents of multiple remote folders.
|
||||||
|
@ -409,6 +412,8 @@ public interface IFileService extends IService
|
||||||
* @param monitor the progress monitor
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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
|
* @param monitor the progress monitor
|
||||||
* @throws SystemMessageException if an error occurs. Typically this would
|
* @throws SystemMessageException if an error occurs. Typically this would
|
||||||
* be one of those in the RemoteFileException family.
|
* 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;
|
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.
|
* 00:00:00 UTC.
|
||||||
* @param monitor the progress monitor
|
* @param monitor the progress monitor
|
||||||
* @see IHostFile#getModifiedDate()
|
* @see IHostFile#getModifiedDate()
|
||||||
|
*
|
||||||
|
* @since org.eclipse.rse.services 3.0
|
||||||
*/
|
*/
|
||||||
public void setLastModified(String parent, String name, long timestamp, IProgressMonitor monitor) throws SystemMessageException;
|
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
|
* @param readOnly indicates whether to make the file read-only or
|
||||||
* read-write
|
* read-write
|
||||||
* @param monitor the progress monitor
|
* @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;
|
public void setReadOnly(String parent, String name, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException;
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
* 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
|
* Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check
|
||||||
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
|
* 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;
|
package org.eclipse.rse.subsystems.files.core.servicesubsystem;
|
||||||
|
@ -386,7 +387,10 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteFileContext context = getDefaultContext();
|
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);
|
return getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, null, nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue