diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java index 99c09e060d4..26462836170 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/ISystemMountPathMapper.java @@ -11,14 +11,16 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * David McKnight (IBM) - [195285] mount path mapper changes ********************************************************************************/ package org.eclipse.rse.files.ui.resources; +import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; + /** * This interface is used to provide a common way of mapping mounted resources to the temp files project. - * Since local mounts can change or be removed (i.e. disconnected) this provides a way for a vender to + * Since local (or remote) mounts can change or be removed (i.e. disconnected) this provides a way for a vender to * remap a particular resource if the vender software is able to determine the new mount location. * Implementors of this interface should register their mappers via the mountPathMapper extension point. */ @@ -28,27 +30,32 @@ public interface ISystemMountPathMapper /** * Indicates whether this mapper handles remapping of the specified resource * @param hostname the remote host - * @param remotePath the remote path as seen by the local file subsystem + * @param remotePath the remote path as seen by the file subsystem * @return whether this mapper handles remapping of the specified remote resource */ public boolean handlesMappingFor(String hostname, String remotePath); /** - * Returns the qualified workspace path for a replica of this mounted file. Since the local + * Returns the qualified workspace path for a replica of this mounted file. Since the * system path is not unique for mounted files, this allows a vender to make sure it is unique. * The workspace mapping should always be the remote path on the originating host. * * @param hostname the remote host - * @param remotePath the remote path as seen by the local file subsystem + * @param remotePath the remote path as seen by the file subsystem + * @param the remote file subsystem. User the subsystem to customize how the temp file is located. If null + * is specified, then the subsystem is not used in determining the mapping * @return the corresponding workspace replica mapping */ - public String getWorkspaceMappingFor(String hostname, String remotePath); + public String getWorkspaceMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem); + /** * Returns the corresponding hostname for the specified path on the specified host. If a file is mounted - * via local, then the actual host containing the file will not be local. If there is no mapping, then - * the hostname will be the same as the argument. + * then the actual host containing the file will not be local. If there is no mapping, then + * the hostname will be the same as the argument. If the file is remote (i.e. not locally mounted) then + * this will retrun the same as the hostname argument. + * * @param hostname the system host * @param remotePath the path on the system host * @return the actual host that contains the specified remote path @@ -56,8 +63,8 @@ public interface ISystemMountPathMapper public String getActualHostFor(String hostname, String remotePath); /** - * Returns the local system path that can be used for copying the replica back to remote. When null - * is returned RSE the file is treated as no longer available and thus remote uploads do not occur. Venders + * Returns the system path that can be used for copying the replica back to remote. When null + * is returned RSE the file is treated as no longer available and thus remote uploads do not occur. Vendors * who would like to disable uploads for some period can implement this to return null during that period. * * @param hostname the remote host diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java index bcac7d50a32..bde7574082d 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java @@ -912,9 +912,9 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP */ public String getWorkspaceRemotePath(String remotePath) { - if (subsystem != null && subsystem.getHost().getSystemType().isLocal()) + if (subsystem != null) { - return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath); + return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath, subsystem); } return remotePath; } diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java index 09e735044ea..b251ef7ae71 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java @@ -18,6 +18,7 @@ * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core * David McKnight (IBM) - [205297] Editor upload should not be on main thread + * David McKnight (IBM) - [195285] mount path mapper changes ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -137,7 +138,7 @@ public class SystemUniversalTempFileListener extends SystemTempFileListener else { // for mounting... - if (fs.getHost().getSystemType().isLocal()) + //if (fs.getHost().getSystemType().isLocal()) { boolean isMounted = properties.getRemoteFileMounted(); if (isMounted) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java index 5b00bdf07a2..0981da28784 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java @@ -28,6 +28,7 @@ * Xuan Chen (IBM) - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted" * Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work * David McKnight (IBM) - [205819] Need to use input stream copy when EFS files are the src + * David McKnight (IBM) - [195285] mount path mapper changes ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -297,7 +298,7 @@ public class UniversalFileTransferUtility } } - protected static void setIFileProperties(IFile tempFile, File remoteFile, String hostname) + protected static void setIFileProperties(IFile tempFile, File remoteFile, String hostname, String userId) { // set it's properties for use later SystemIFileProperties properties = new SystemIFileProperties(tempFile); @@ -322,8 +323,8 @@ public class UniversalFileTransferUtility properties.setRemoteFileMounted(isMounted); if (isMounted) { - String actualRemoteHost = getActualHostFor(hostname, remotePath); - String actualRemotePath = getWorkspaceRemotePath(hostname, remotePath); + String actualRemoteHost = getActualHostFor(hostname, remotePath); + String actualRemotePath = getWorkspaceRemotePath(hostname, remotePath, null); // no subsystem properties.setResolvedMountedRemoteFileHost(actualRemoteHost); properties.setResolvedMountedRemoteFilePath(actualRemotePath); } @@ -554,7 +555,7 @@ public class UniversalFileTransferUtility { try { - setIFileProperties(tempFile, srcFileOrFolder, "LOCALHOST"); //$NON-NLS-1$ + setIFileProperties(tempFile, srcFileOrFolder, "LOCALHOST", System.getProperty("user.name")); //$NON-NLS-1$ //$NON-NLS-2$ } catch (Exception e) { @@ -1860,7 +1861,7 @@ public class UniversalFileTransferUtility if (srcFileOrFolder.getSystemConnection().getSystemType().isLocal()) { - absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath()); + absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath(), srcFileOrFolder.getParentRemoteFileSubSystem()); } IPath remote = new Path(absolutePath); @@ -1932,7 +1933,8 @@ public class UniversalFileTransferUtility String actualHost = "LOCALHOST"; //$NON-NLS-1$ path = path.append(separator + actualHost + separator); - String absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath()); + // this is only for local, so no remote name required + String absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath(), null); // no subsystem int colonIndex = absolutePath.indexOf(IPath.DEVICE_SEPARATOR); @@ -2097,17 +2099,17 @@ public class UniversalFileTransferUtility return false; } - protected static String getWorkspaceRemotePath(ISubSystem subsystem, String remotePath) { + protected static String getWorkspaceRemotePath(IRemoteFileSubSystem subsystem, String remotePath) { - if (subsystem != null && subsystem.getHost().getSystemType().isLocal()) { - return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath); + if (subsystem != null) { + return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath, subsystem); } return remotePath; } - protected static String getWorkspaceRemotePath(String hostname, String remotePath) { - return SystemRemoteEditManager.getInstance().getWorkspacePathFor(hostname, remotePath); + protected static String getWorkspaceRemotePath(String hostname, String remotePath, IRemoteFileSubSystem subsystem) { + return SystemRemoteEditManager.getInstance().getWorkspacePathFor(hostname, remotePath, subsystem); } protected static RenameStatus checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java index 529b30e0e9e..1e07a62119b 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java @@ -13,11 +13,13 @@ * * Contributors: * {Name} (company) - description of contribution. + * David McKnight (IBM) - [195285] mount path mapper changes *******************************************************************************/ package org.eclipse.rse.internal.files.ui.resources; import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper; +import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; public class DefaultMountPathMapper implements ISystemMountPathMapper { @@ -32,7 +34,7 @@ public class DefaultMountPathMapper implements ISystemMountPathMapper return hostname; } - public String getWorkspaceMappingFor(String hostname, String remotePath) + public String getWorkspaceMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subSystem) { return remotePath; } diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java index dd60b46268b..66003f2b9be 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core + * David McKnight (IBM) - [195285] mount path mapper changes ********************************************************************************/ package org.eclipse.rse.internal.files.ui.resources; @@ -41,6 +42,7 @@ import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper; import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; import org.eclipse.rse.subsystems.files.core.SystemIFileProperties; +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.view.ISystemEditableRemoteObject; @@ -113,6 +115,7 @@ public class SystemRemoteEditManager * Return the path to use on the system (i.e. Windows) for saving from the workspace to remote * @param hostname the remote host * @param remotePath the file path on the remote host + * @return the system path */ public String getMountPathFor(String hostname, String remotePath) @@ -128,18 +131,20 @@ public class SystemRemoteEditManager } } + /** * Return the path to use relative to the hostname in the RemoteSystemsTempFiles project for saving a local replica * @param hostname the originating remote host * @param remotePath the file path on the system (i.e. Windows) + * @param subSystem the remote subsystem. The subsystem may be null if none is available. * @return the relative replica path */ - public String getWorkspacePathFor(String hostname, String remotePath) + public String getWorkspacePathFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem) { ISystemMountPathMapper mapper = getMountPathMapperFor(hostname, remotePath); if (mapper != null) { - return mapper.getWorkspaceMappingFor(hostname, remotePath); + return mapper.getWorkspaceMappingFor(hostname, remotePath, subsystem); } else {