1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 13:35:22 +02:00

[195285] mount path mapper changes

This commit is contained in:
David McKnight 2007-10-19 14:58:23 +00:00
parent c06b4f097d
commit 547f047169
6 changed files with 44 additions and 27 deletions

View file

@ -11,14 +11,16 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * David McKnight (IBM) - [195285] mount path mapper changes
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.files.ui.resources; 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. * 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. * 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. * 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 * Indicates whether this mapper handles remapping of the specified resource
* @param hostname the remote 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
* @return whether this mapper handles remapping of the specified remote resource * @return whether this mapper handles remapping of the specified remote resource
*/ */
public boolean handlesMappingFor(String hostname, String remotePath); 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. * 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. * The workspace mapping should always be the remote path on the originating host.
* *
* @param hostname the remote 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 * @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 * 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 * 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. * 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 hostname the system host
* @param remotePath the path on the system host * @param remotePath the path on the system host
* @return the actual host that contains the specified remote path * @return the actual host that contains the specified remote path
@ -56,8 +63,8 @@ public interface ISystemMountPathMapper
public String getActualHostFor(String hostname, String remotePath); 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 * 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. Venders * 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. * who would like to disable uploads for some period can implement this to return null during that period.
* *
* @param hostname the remote host * @param hostname the remote host

View file

@ -912,9 +912,9 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP
*/ */
public String getWorkspaceRemotePath(String remotePath) 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; return remotePath;
} }

View file

@ -18,6 +18,7 @@
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core * 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) - [205297] Editor upload should not be on main thread
* David McKnight (IBM) - [195285] mount path mapper changes
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.files.ui.resources; package org.eclipse.rse.files.ui.resources;
@ -137,7 +138,7 @@ public class SystemUniversalTempFileListener extends SystemTempFileListener
else else
{ {
// for mounting... // for mounting...
if (fs.getHost().getSystemType().isLocal()) //if (fs.getHost().getSystemType().isLocal())
{ {
boolean isMounted = properties.getRemoteFileMounted(); boolean isMounted = properties.getRemoteFileMounted();
if (isMounted) if (isMounted)

View file

@ -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) - [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 * 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) - [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; 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 // set it's properties for use later
SystemIFileProperties properties = new SystemIFileProperties(tempFile); SystemIFileProperties properties = new SystemIFileProperties(tempFile);
@ -322,8 +323,8 @@ public class UniversalFileTransferUtility
properties.setRemoteFileMounted(isMounted); properties.setRemoteFileMounted(isMounted);
if (isMounted) if (isMounted)
{ {
String actualRemoteHost = getActualHostFor(hostname, remotePath); String actualRemoteHost = getActualHostFor(hostname, remotePath);
String actualRemotePath = getWorkspaceRemotePath(hostname, remotePath); String actualRemotePath = getWorkspaceRemotePath(hostname, remotePath, null); // no subsystem
properties.setResolvedMountedRemoteFileHost(actualRemoteHost); properties.setResolvedMountedRemoteFileHost(actualRemoteHost);
properties.setResolvedMountedRemoteFilePath(actualRemotePath); properties.setResolvedMountedRemoteFilePath(actualRemotePath);
} }
@ -554,7 +555,7 @@ public class UniversalFileTransferUtility
{ {
try 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) catch (Exception e)
{ {
@ -1860,7 +1861,7 @@ public class UniversalFileTransferUtility
if (srcFileOrFolder.getSystemConnection().getSystemType().isLocal()) if (srcFileOrFolder.getSystemConnection().getSystemType().isLocal())
{ {
absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath()); absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath(), srcFileOrFolder.getParentRemoteFileSubSystem());
} }
IPath remote = new Path(absolutePath); IPath remote = new Path(absolutePath);
@ -1932,7 +1933,8 @@ public class UniversalFileTransferUtility
String actualHost = "LOCALHOST"; //$NON-NLS-1$ String actualHost = "LOCALHOST"; //$NON-NLS-1$
path = path.append(separator + actualHost + separator); 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); int colonIndex = absolutePath.indexOf(IPath.DEVICE_SEPARATOR);
@ -2097,17 +2099,17 @@ public class UniversalFileTransferUtility
return false; 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()) { if (subsystem != null) {
return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath); return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath, subsystem);
} }
return remotePath; return remotePath;
} }
protected static String getWorkspaceRemotePath(String hostname, String remotePath) { protected static String getWorkspaceRemotePath(String hostname, String remotePath, IRemoteFileSubSystem subsystem) {
return SystemRemoteEditManager.getInstance().getWorkspacePathFor(hostname, remotePath); return SystemRemoteEditManager.getInstance().getWorkspacePathFor(hostname, remotePath, subsystem);
} }
protected static RenameStatus checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath) protected static RenameStatus checkForCollision(SystemRemoteResourceSet existingFiles, IRemoteFile targetFolder, String oldName, String oldPath)

View file

@ -13,11 +13,13 @@
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
* David McKnight (IBM) - [195285] mount path mapper changes
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.files.ui.resources; package org.eclipse.rse.internal.files.ui.resources;
import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper; import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
public class DefaultMountPathMapper implements ISystemMountPathMapper public class DefaultMountPathMapper implements ISystemMountPathMapper
{ {
@ -32,7 +34,7 @@ public class DefaultMountPathMapper implements ISystemMountPathMapper
return hostname; return hostname;
} }
public String getWorkspaceMappingFor(String hostname, String remotePath) public String getWorkspaceMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subSystem)
{ {
return remotePath; return remotePath;
} }

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core * 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; 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.files.ui.resources.ISystemMountPathMapper;
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
import org.eclipse.rse.subsystems.files.core.SystemIFileProperties; 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.RSEUIPlugin;
import org.eclipse.rse.ui.SystemBasePlugin; import org.eclipse.rse.ui.SystemBasePlugin;
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject; 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 * Return the path to use on the system (i.e. Windows) for saving from the workspace to remote
* @param hostname the remote host * @param hostname the remote host
* @param remotePath the file path on the remote host * @param remotePath the file path on the remote host
* @return the system path * @return the system path
*/ */
public String getMountPathFor(String hostname, String remotePath) 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 * 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 hostname the originating remote host
* @param remotePath the file path on the system (i.e. Windows) * @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 * @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); ISystemMountPathMapper mapper = getMountPathMapperFor(hostname, remotePath);
if (mapper != null) if (mapper != null)
{ {
return mapper.getWorkspaceMappingFor(hostname, remotePath); return mapper.getWorkspaceMappingFor(hostname, remotePath, subsystem);
} }
else else
{ {