diff --git a/rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java b/rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java index 604efbc8c06..cb47e5e0310 100644 --- a/rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java +++ b/rse/plugins/org.eclipse.rse.efs/src/org/eclipse/rse/internal/efs/RSEFileStoreImpl.java @@ -27,6 +27,7 @@ * Kevin Doyle (IBM) - [208778] [efs][api] RSEFileStore#getOutputStream() does not support EFS#APPEND * Kevin Doyle (IBM) - [210673] [efs][nls] Externalize Strings in RSEFileStore and RSEFileStoreImpl * Timur Shipilov (Xored) - [224540] [efs] RSEFileStore.mkdir(EFS.NONE, null) doesn't create parent folder + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService ********************************************************************************/ package org.eclipse.rse.internal.efs; @@ -560,28 +561,22 @@ public class RSEFileStoreImpl extends FileStore * @see org.eclipse.core.filesystem.provider.FileStore#putInfo(org.eclipse.core.filesystem.IFileInfo, int, org.eclipse.core.runtime.IProgressMonitor) */ public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException { - boolean success = true; // connect if needed. Will throw exception if not successful. IRemoteFile remoteFile = getRemoteFileObject(monitor, false); IRemoteFileSubSystem subSys = remoteFile.getParentRemoteFileSubSystem(); try { if ((options & EFS.SET_ATTRIBUTES) != 0) { //We cannot currently write isExecutable(), isHidden() - success &= subSys.setReadOnly(remoteFile, info.getAttribute(EFS.ATTRIBUTE_READ_ONLY), monitor); + subSys.setReadOnly(remoteFile, info.getAttribute(EFS.ATTRIBUTE_READ_ONLY), monitor); } if ((options & EFS.SET_LAST_MODIFIED) != 0) { - success &= subSys.setLastModified(remoteFile, info.getLastModified(), monitor); + subSys.setLastModified(remoteFile, info.getLastModified(), monitor); } } catch(Exception e) { throw new CoreException(new Status(IStatus.ERROR, Activator.getDefault().getBundle().getSymbolicName(), getExceptionMessage(toString(), e), e)); } - if (!success) { - cacheRemoteFile(null); - //will throw exception if not exists - remoteFile = getRemoteFileObject(monitor, true); - } } /* @@ -719,12 +714,7 @@ public class RSEFileStoreImpl extends FileStore IRemoteFileSubSystem subSys = remoteFile.getParentRemoteFileSubSystem(); try { cacheRemoteFile(null); - boolean success = subSys.delete(remoteFile, monitor); - if (!success) { - throw new CoreException(new Status(IStatus.ERROR, - Activator.getDefault().getBundle().getSymbolicName(), - Messages.DELETE_FAILED)); - } + subSys.delete(remoteFile, monitor); } catch (SystemMessageException e) { throw new CoreException(new Status(IStatus.ERROR, diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java index 5a349fc154f..679c6956057 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCopyRemoteFileAction.java @@ -23,6 +23,7 @@ * Rupen Mardirossian (IBM) - [210682] created checkForCollision method that returns a boolean for SystemCopyDialog enhancement * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields * David McKnight (IBM) - [224377] "open with" menu does not have "other" option + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService ********************************************************************************/ package org.eclipse.rse.internal.files.ui.actions; @@ -264,9 +265,12 @@ implements IValidatorRemoteSelection if (targetConnection == srcConnection) { ss = targetFolder.getParentRemoteFileSubSystem(); - - - ok = ss.copy(srcFileOrFolder, targetFolder, newName, null); + try { + ss.copy(srcFileOrFolder, targetFolder, newName, null); + ok = true; + } catch (Exception e) { + SystemBasePlugin.logError("Exception occurred during copy", e); //$NON-NLS-1$ + } if (!ok) { String msgTxt = NLS.bind(FileResources.FILEMSG_COPY_FILE_FAILED, srcFileOrFolder.getName()); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java index af25bece662..21f03192f8e 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemMoveRemoteFileAction.java @@ -24,6 +24,7 @@ * Rupen Mardirossian (IBM) - [210682] Modified MoveRemoteFileJob.runInWorkspace to use SystemCopyDialog for collisions in move operations * David McKnight (IBM) - [224313] [api] Create RSE Events for MOVE and COPY holding both source and destination fields * David McKnight (IBM) - [224377] "open with" menu does not have "other" option + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService ********************************************************************************/ package org.eclipse.rse.internal.files.ui.actions; @@ -51,6 +52,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; import org.eclipse.rse.ui.RSEUIPlugin; +import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.actions.SystemBaseCopyAction; import org.eclipse.rse.ui.messages.SystemMessageDialog; import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; @@ -246,8 +248,12 @@ public class SystemMoveRemoteFileAction extends SystemCopyRemoteFileAction IRemoteFileSubSystem ss = targetFolder.getParentRemoteFileSubSystem(); boolean ok = false; - - ok = ss.move(srcFileOrFolder, targetFolder, newName, monitor); + try { + ss.move(srcFileOrFolder, targetFolder, newName, monitor); + ok = true; + } catch (Exception e) { + SystemBasePlugin.logError("Exception occurred during a move operation", e); //$NON-NLS-1$ + } if (!ok) { String msgTxt = NLS.bind(FileResources.FILEMSG_MOVE_FILE_FAILED, srcFileOrFolder.getName()); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java index 27f3341bf70..fd85e9602bc 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java @@ -54,6 +54,7 @@ * Rupen Mardirossian (IBM) - [198728] Folder being copied across systems is added to original set of files in order to extract empty (sub)folders in doDrop method * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding * Rupen Mardirossian (IBM) - [227213] Copy and pasting to the parent folder will create a "Copy of" that resource + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService *******************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -2255,24 +2256,9 @@ public class SystemViewRemoteFileAdapter try { - if (targetFS.copy(srcFileOrFolder, targetFolder, name, monitor)) - { - IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor); - resultSet.addResource(copiedFile); - } - else - { - // need a failed message here - String msgTxt = NLS.bind(FileResources.FILEMSG_COPY_FILE_FAILED, srcFileOrFolder.getAbsolutePath()); - String msgDetails = FileResources.FILEMSG_COPY_FILE_FAILED_DETAILS; - - - - SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, - ISystemFileConstants.FILEMSG_COPY_FILE_FAILED, - IStatus.ERROR, msgTxt, msgDetails); - resultSet.setMessage(msg); - } + targetFS.copy(srcFileOrFolder, targetFolder, name, monitor); + IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor); + resultSet.addResource(copiedFile); } catch (SystemMessageException e) { @@ -2593,12 +2579,9 @@ public class SystemViewRemoteFileAdapter if (name != null) { monitor.subTask(copyMessage.getLevelOneText()); - if (targetFS.copy(srcFileOrFolder, targetFolder, name, monitor)) - { - IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor); - return copiedFile; - - } + targetFS.copy(srcFileOrFolder, targetFolder, name, monitor); + IRemoteFile copiedFile = targetFS.getRemoteFileObject(targetFolder, name, monitor); + return copiedFile; } } } @@ -2799,8 +2782,8 @@ public class SystemViewRemoteFileAdapter } } */ - ok = ss.delete(file, monitor); - + ss.delete(file, monitor); + ok = true; file.markStale(true); parentFile.markStale(true); } @@ -2851,7 +2834,6 @@ public class SystemViewRemoteFileAdapter } catch (Exception exc) { - ok = false; ok = false; String msgTxt = NLS.bind(FileResources.FILEMSG_DELETE_FILE_FAILED, file.toString()); String msgDetails = FileResources.FILEMSG_DELETE_FILE_FAILED_DETAILS; @@ -2864,7 +2846,13 @@ public class SystemViewRemoteFileAdapter } if (ss != null) { - ok = ss.deleteBatch(files, monitor); + try { + ss.deleteBatch(files, monitor); + ok = true; + } catch (Exception e) { + SystemBasePlugin.logError("Exception occurred during batch delete", e); //$NON-NLS-1$ + ok = false; + } return ok; } else @@ -2960,7 +2948,12 @@ public class SystemViewRemoteFileAdapter localResource = UniversalFileTransferUtility.getTempFileFor(file); } - ok = ss.rename(file, newName, monitor); + try { + ss.rename(file, newName, monitor); + } catch (Exception e) { + SystemBasePlugin.logError("Exception occurred during rename", e); //$NON-NLS-1$ + ok = false; + } if (localResource != null && localResource.exists()) { diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java index e578bf9a155..06491a25aa2 100644 --- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java +++ b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2008 IBM Corporation and others. * 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 @@ -10,6 +10,7 @@ * 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 + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService *******************************************************************************/ package org.eclipse.rse.internal.importexport.files; @@ -93,7 +94,7 @@ public class UniFilePlus extends File { public boolean delete() { boolean ok = true; try { - ok = remoteFile.getParentRemoteFileSubSystem().delete(remoteFile, new NullProgressMonitor()); + remoteFile.getParentRemoteFileSubSystem().delete(remoteFile, new NullProgressMonitor()); //hmm, should we set remoteFile to null? } catch (RemoteFileException exc) { Exception e = exc.getRemoteException(); @@ -321,7 +322,8 @@ public class UniFilePlus extends File { public boolean renameTo(File dest) { boolean ok = false; try { - ok = remoteFile.getParentRemoteFileSubSystem().rename(remoteFile, dest.getName(), new NullProgressMonitor()); + remoteFile.getParentRemoteFileSubSystem().rename(remoteFile, dest.getName(), new NullProgressMonitor()); + ok = true; } catch (RemoteFileException exc) { Exception e = exc.getRemoteException(); if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e; @@ -338,7 +340,8 @@ public class UniFilePlus extends File { if (time < 0) throw new IllegalArgumentException(); try { IProgressMonitor monitor = new NullProgressMonitor(); - ok = remoteFile.getParentRemoteFileSubSystem().setLastModified(remoteFile, time, monitor); + remoteFile.getParentRemoteFileSubSystem().setLastModified(remoteFile, time, monitor); + ok = true; } catch (RemoteFileException exc) { Exception e = exc.getRemoteException(); if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e; @@ -353,7 +356,8 @@ public class UniFilePlus extends File { public boolean setReadOnly() { boolean ok = false; try { - ok = remoteFile.getParentRemoteFileSubSystem().setReadOnly(remoteFile, true, new NullProgressMonitor()); + remoteFile.getParentRemoteFileSubSystem().setReadOnly(remoteFile, true, new NullProgressMonitor()); + ok = true; } catch (RemoteFileException exc) { Exception e = exc.getRemoteException(); if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) 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 8dc6f027a44..74de12108b9 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 @@ -37,6 +37,7 @@ * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading * David Dykstal (IBM) - [221211] fix IFileService API for batch operations * Martin Oberhuber (Wind River) - [221211] Fix markStale() for delete() operation with exceptions + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService *******************************************************************************/ package org.eclipse.rse.subsystems.files.core.servicesubsystem; @@ -797,14 +798,13 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe * (non-Javadoc) * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#copy(org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) */ - public boolean copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException + public void copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException { IFileService service = getFileService(); service.copy(sourceFolderOrFile.getParentPath(), sourceFolderOrFile.getName(), targetFolder.getAbsolutePath(), newName, monitor); - return true; } - public boolean copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException + public void copyBatch(IRemoteFile[] sourceFolderOrFiles, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException { IFileService service = getFileService(); String[] sourceParents = new String[sourceFolderOrFiles.length]; @@ -816,7 +816,6 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe sourceNames[i] = sourceFolderOrFiles[i].getName(); } service.copyBatch(sourceParents, sourceNames, targetFolder.getAbsolutePath(), monitor); - return true; } public IRemoteFile getParentFolder(IRemoteFile folderOrFile, IProgressMonitor monitor) @@ -854,7 +853,7 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe return createFolder(folderToCreate, monitor); } - public boolean delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException + public void delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException { IFileService service = getFileService(); String parent = folderOrFile.getParentPath(); @@ -864,10 +863,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe } finally { folderOrFile.markStale(true); } - return true; } - public boolean deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException + public void deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException { String[] parents = new String[folderOrFiles.length]; @@ -882,10 +880,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe } IFileService service = getFileService(); service.deleteBatch(parents, names, monitor); - return true; } - public boolean rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException + public void rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException { removeCachedRemoteFile(folderOrFile); IFileService service = getFileService(); @@ -894,10 +891,9 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe String newPath = srcParent + folderOrFile.getSeparator() + newName; service.rename(srcParent, oldName, newName, monitor); folderOrFile.getHostFile().renameTo(newPath); - return true; } - public boolean move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException + public void move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException { IFileService service = getFileService(); String srcParent = sourceFolderOrFile.getParentPath(); @@ -910,23 +906,20 @@ public class FileServiceSubSystem extends RemoteFileSubSystem implements IFileSe sourceFolderOrFile.markStale(true); targetFolder.markStale(true); } - return true; } - public boolean setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException + public void setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException { String name = folderOrFile.getName(); String parent = folderOrFile.getParentPath(); _hostFileService.setLastModified(parent, name, newDate, monitor); - return true; } - public boolean setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException + public void setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException { String name = folderOrFile.getName(); String parent = folderOrFile.getParentPath(); _hostFileService.setReadOnly(parent, name, readOnly, monitor); - return true; } public ILanguageUtilityFactory getLanguageUtilityFactory() 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 ae05f47d23b..5e0da40ffec 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 @@ -21,6 +21,7 @@ * Kevin Doyle (IBM) - [208778] new API getOutputSteam for getting an output stream in append mode * David McKnight (IBM) - [209704] added supportsEncodingConversion() * Martin Oberhuber (Wind River) - [226574][api] Add ISubSystemConfiguration#supportsEncoding() + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService *******************************************************************************/ package org.eclipse.rse.subsystems.files.core.subsystems; @@ -370,40 +371,43 @@ public interface IRemoteFileSubSystem extends ISubSystem { * * @param folderOrFile represents the object to be deleted. * @param monitor progressMonitor - * @return false if the given folder/file didn't exist to begin with, else true. Throws an exception if anything fails. * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException; + public void delete(IRemoteFile folderOrFile, IProgressMonitor monitor) throws SystemMessageException; /** * Delete the given batch of remote file or folder. * - * Should throw an exception if some files and folders were deleted and others were not due to an exception during the operation. + *

+ * If an error occurs during the deletion of an item, this operation stops on that item and a {@link SystemMessageException} is thrown. + * Items deleted before that item will remain deleted. Items specified after that item will not be deleted. + * The item on which the error occurs will not be deleted. * Without an exception thrown in such cases, views may not be refreshed correctly to account for deleted resources. * @param folderOrFiles represents the objects to be deleted. * @param monitor progressMonitor - * @return false if any of the given folder/file dont exist to begin with, else true. Throws an exception if anything fails. * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException; + public void deleteBatch(IRemoteFile[] folderOrFiles, IProgressMonitor monitor) throws SystemMessageException; /** * Rename the given remote file or folder. This renames it in memory and, iff it exists, on disk. * @param folderOrFile represents the object to be renamed. * @param newName new name to give it. * @param monitor the progress monitor - * @return false if the given folder/file didn't exist on disk (still renamed in memory), else true. Throws an exception if anything fails. * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException; + public void rename(IRemoteFile folderOrFile, String newName, IProgressMonitor monitor) throws SystemMessageException; /** * Move a file or folder to a new target parent folder. @@ -412,12 +416,12 @@ public interface IRemoteFileSubSystem extends ISubSystem { * @param targetFolder The folder to move to. No guarantee it is on the same system, so be sure to check getSystemConnection()! * @param newName The new name for the moved file or folder * @param monitor progress monitor - * @return true if the move succeeded * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName,IProgressMonitor monitor) throws SystemMessageException; + public void move(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName,IProgressMonitor monitor) throws SystemMessageException; /** * Set the last modified date for the given file or folder. Like a Unix "touch" operation. @@ -425,12 +429,12 @@ public interface IRemoteFileSubSystem extends ISubSystem { * @param folderOrFile represents the object to be renamed. * @param newDate new date, in milliseconds from epoch, to assign. * @param monitor the progress monitor - * @return false if the given folder/file didn't exist on disk (operation fails), else true. Throws an exception if anything fails. * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException; + public void setLastModified(IRemoteFile folderOrFile, long newDate, IProgressMonitor monitor) throws SystemMessageException; /** * Set a files read-only permissions. @@ -438,12 +442,12 @@ public interface IRemoteFileSubSystem extends ISubSystem { * @param folderOrFile represents the object to be renamed. * @param readOnly whether to set it to be read-only or not * @param monitor the progress monitor - * @return false if the given folder/file didn't exist on disk (operation fails), else true. Throws an exception if anything fails. * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException; + public void setReadOnly(IRemoteFile folderOrFile, boolean readOnly, IProgressMonitor monitor) throws SystemMessageException; // ---------------------------- @@ -454,29 +458,32 @@ public interface IRemoteFileSubSystem extends ISubSystem { /** * Copy a file or folder to a new target parent folder. - * * @param sourceFolderOrFile The file or folder to copy * @param targetFolder The folder to copy to. No guarantee it is on the same system, so be sure to check getSystemConnection()! * @param newName The new name for the copied file or folder * @param monitor progress monitor - * @return true if the copy succeeded * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException; + public void copy(IRemoteFile sourceFolderOrFile, IRemoteFile targetFolder, String newName, IProgressMonitor monitor) throws SystemMessageException; /** - * Copy a set of remote files or folders to a new target parent folder. Precondition: Sources and target must all be on the same system! + * Copy a set of remote files or folders to a new target parent folder. Precondition: Sources and target must all be on the same system. + *

+ * If an error occurs during the copy of an item, this operation stops on that item and a {@link SystemMessageException} is thrown. + * Items copied before that item will remain copied. Items copied after that item will not be copied. + * The item on which the error occurs will not be copied. * @param sourceFolderOrFile The file or folder to copy * @param targetFolder The folder to copy to. * @param monitor progress monitor - * @return true if all copies succeeded * @throws SystemMessageException if an error occurs. * Typically this would be one of those in the * {@link RemoteFileException} family. + * @since org.eclipse.rse.subsystems.files.core 3.0 */ - public boolean copyBatch(IRemoteFile[] sourceFolderOrFile, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException; + public void copyBatch(IRemoteFile[] sourceFolderOrFile, IRemoteFile targetFolder, IProgressMonitor monitor) throws SystemMessageException; /** * Get the remote file and save it locally. diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java index 73edad5ab67..9c022c71cdf 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileServiceBaseTest.java @@ -12,6 +12,7 @@ * - * - * Martin Oberhuber (Wind River) - [195402] Add constructor with test name + * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService *******************************************************************************/ package org.eclipse.rse.tests.subsystems.files; @@ -110,16 +111,11 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase { public IRemoteFile copySourceFileOrFolder(String sourceFullName, String sourceName, String targetFolderFullName) throws Exception { - boolean ok = false; IRemoteFile result = null; IRemoteFile originalTargetArchiveFile = fss.getRemoteFileObject(sourceFullName, mon); IRemoteFile targetFolder = fss.getRemoteFileObject(targetFolderFullName, mon); - ok = fss.copy(originalTargetArchiveFile, targetFolder, sourceName, mon); - if (ok) - { - //copy is successful - result = fss.getRemoteFileObject(getNewAbsoluteName(targetFolder, sourceName), mon); - } + fss.copy(originalTargetArchiveFile, targetFolder, sourceName, mon); + result = fss.getRemoteFileObject(getNewAbsoluteName(targetFolder, sourceName), mon); //Need to call resolveFilterString of the parent to make sure the newly copied child //is added to the DStore map. Otherwise, next time when query it, it will just created a //default filter string. And the dstore server cannot handler it correctly.