org.eclipse.rse.files.ui.resources
Class UniversalFileTransferUtility
java.lang.Object
org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility
-
public class UniversalFileTransferUtility
- extends
Object
Utility class for doing file transfers on universal systems.
Method Summary
|
protected static
String
|
checkForCollision
(
IRemoteFile targetFolder,
String oldName)
|
protected static boolean
|
checkForCollision
(
SystemRemoteResourceSet existingFiles,
IRemoteFile targetFolder,
String oldPath)
|
protected static
UniversalFileTransferUtility.RenameStatus
|
checkForCollision
(
SystemRemoteResourceSet existingFiles,
IRemoteFile targetFolder,
String oldName,
String oldPath)
|
protected static
UniversalFileTransferUtility.RenameStatus
|
checkForCollision
(
SystemRemoteResourceSet existingFiles,
IRemoteFile targetFolder,
String oldName,
String oldPath,
List NamesInUse)
|
protected static void
|
cleanup
(
IRemoteFile arc1,
File arc2)
|
static
IResource
|
compressedCopyRemoteResourceToWorkspace
(
IRemoteFile directory,
IProgressMonitor monitor)
Deprecated. use compressedDownloadToWorkspace
|
static void
|
compressedCopyWorkspaceResourceToRemote
(
IContainer directory,
IRemoteFile newTargetFolder,
IProgressMonitor monitor)
Deprecated. use compressedUploadFromWorkspace
|
static
IResource
|
compressedDownloadToWorkspace
(
IRemoteFile directory,
IProgressMonitor monitor)
|
static void
|
compressedUploadFromWorkspace
(
IContainer directory,
IRemoteFile newTargetFolder,
IProgressMonitor monitor)
|
protected static
IFile
|
copyRemoteFileToWorkspace
(
File srcFileOrFolder,
IProgressMonitor monitor)
Deprecated. use downloadFileToWorkspace
|
protected static
IFile
|
copyRemoteFileToWorkspace
(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
Deprecated. use downloadFileToWorkspace
|
static
SystemWorkspaceResourceSet
|
copyRemoteResourcesToWorkspace
(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
Deprecated. use downloadResourcesToWorkspace
|
static
SystemWorkspaceResourceSet
|
copyRemoteResourcesToWorkspaceMultiple
(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
Deprecated. use downloadResourcesToWorkspaceMultiple
|
static
Object
|
copyRemoteResourceToWorkspace
(
File srcFileOrFolder,
IProgressMonitor monitor)
Deprecated. use downloadResourceToWorkspace
|
static
Object
|
copyRemoteResourceToWorkspace
(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
Deprecated. use downloadResourceToWorkspace
|
static
SystemRemoteResourceSet
|
copyWorkspaceResourcesToRemote
(
SystemWorkspaceResourceSet workspaceSet,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
Deprecated. use uploadResourcesFromWorkspace
|
static
Object
|
copyWorkspaceResourceToRemote
(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor)
Deprecated. use uploadResourceFromWorkspace
|
static
Object
|
copyWorkspaceResourceToRemote
(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
Deprecated. use uploadResourceFromWorkspace
|
static void
|
discardReplicasOfDeletedFiles
(
IRemoteFileSubSystem ss,
IContainer folder)
|
protected static boolean
|
download
(
File file,
IFile tempFile,
String hostEncoding,
IProgressMonitor monitor)
|
protected static
IFile
|
downloadFileToWorkspace
(
File srcFileOrFolder,
IProgressMonitor monitor)
Replicates a local file to the temporary files project in the workspace. |
protected static
IFile
|
downloadFileToWorkspace
(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
replicates a remote file to the temp files project in the workspace |
static
SystemWorkspaceResourceSet
|
downloadResourcesToWorkspace
(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
Replicates a set of remote files or folders to the workspace |
static
SystemWorkspaceResourceSet
|
downloadResourcesToWorkspaceMultiple
(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
This method downloads a set of remote resources to the workspace. |
static
Object
|
downloadResourceToWorkspace
(
File srcFileOrFolder,
IProgressMonitor monitor)
|
static
Object
|
downloadResourceToWorkspace
(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
Replicates a remote file or folder to the workspace |
static
String
|
getActualHostFor
(
IRemoteFileSubSystem subsystem,
String remotePath)
|
static
String
|
getActualHostFor
(
String hostname,
String remotePath,
IRemoteFileSubSystem subsystem)
|
protected static
String
|
getArchiveExtensionFromProperties
()
|
static
IResource
|
getTempFileFor
(
File srcFileOrFolder)
Returns the corresponding temp file location for a local file or folder. |
static
IResource
|
getTempFileFor
(
IRemoteFile srcFileOrFolder)
Returns the corresponding temp file location for a remote file or folder |
protected static
String
|
getWorkspaceRemotePath
(
IRemoteFileSubSystem subsystem,
String remotePath)
|
protected static
String
|
getWorkspaceRemotePath
(
String hostname,
String remotePath,
IRemoteFileSubSystem subsystem)
|
protected static boolean
|
isRemoteFileMounted
(
ISubSystem subsystem,
String remotePath)
|
protected static boolean
|
isRemoteFileMounted
(
String hostname,
String remotePath,
IRemoteFileSubSystem subsystem)
|
protected static
String
|
normalizePath
(
String localpath,
char rmtSeparator)
|
protected static void
|
setIFileProperties
(
IFile tempFile,
File remoteFile,
String hostname,
String userId)
Used for local files - special case! |
protected static void
|
setIFileProperties
(
IFile tempFile,
IRemoteFile remoteFile,
IRemoteFileSubSystem subSystem)
|
protected static void
|
setReadOnly
(
IFile file,
boolean flag)
|
static void
|
transferProperties
(
IResource source,
IRemoteFile target,
IProgressMonitor monitor)
|
static void
|
transferRemoteResource
(
IRemoteFile srcFileOrFolder,
IRemoteFile tgtFolder,
IProgressMonitor monitor)
Transfer a remote file or folder from one remote location to another. |
static
Object
|
uploadResourceFromWorkspace
(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor)
Perform a copy via drag and drop. |
static
Object
|
uploadResourceFromWorkspace
(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
Perform a copy via drag and drop. |
static
SystemRemoteResourceSet
|
uploadResourcesFromWorkspace
(
SystemWorkspaceResourceSet workspaceSet,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
Perform a copy via drag and drop. |
protected static
String
|
useLocalSeparator
(
String virtualPath)
|
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
UniversalFileTransferUtility
public UniversalFileTransferUtility()
transferRemoteResource
public static void transferRemoteResource(
IRemoteFile srcFileOrFolder,
IRemoteFile tgtFolder,
IProgressMonitor monitor)
- Transfer a remote file or folder from one remote location to another.
-
-
Parameters:
-
srcFileOrFolder
- the file or folder to copy -
tgtFolder
- the folder to copy to -
monitor
- the progress monitor
downloadFileToWorkspace
protected static
IFile downloadFileToWorkspace(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
- replicates a remote file to the temp files project in the workspace
-
-
Parameters:
-
srcFileOrFolder
- the file to copy -
monitor
- the progress monitor
-
Returns:
- the resulting local replica, or
null
if the
operation was cancelled before the download was complete -
Since:
- 3.0
setIFileProperties
protected static void setIFileProperties(
IFile tempFile,
IRemoteFile remoteFile,
IRemoteFileSubSystem subSystem)
-
setIFileProperties
protected static void setIFileProperties(
IFile tempFile,
File remoteFile,
String hostname,
String userId)
- Used for local files - special case!
-
-
Parameters:
-
tempFile
- -
remoteFile
- -
hostname
- -
userId
- -
Since:
- 3.0
downloadResourcesToWorkspaceMultiple
public static
SystemWorkspaceResourceSet downloadResourcesToWorkspaceMultiple(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
- This method downloads a set of remote resources to the workspace. It uses
the downloadMultiple() API of the remote file subsystem and service
layers so for some service implementations, this is a big optimization
-
-
Parameters:
-
remoteSet
- the set of resources to download -
monitor
- the progress monitor
-
Returns:
- the set of temporary files created as a result of the download.
This may contain fewer files than requested in case the operation
was cancelled.
-
Since:
- 3.0
downloadResourcesToWorkspace
public static
SystemWorkspaceResourceSet downloadResourcesToWorkspace(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
- Replicates a set of remote files or folders to the workspace
-
-
Parameters:
-
remoteSet
- the objects which are being copied -
monitor
- a progress monitor
-
Returns:
- the temporary objects that was created after the download
-
Since:
- 3.0
discardReplicasOfDeletedFiles
public static void discardReplicasOfDeletedFiles(
IRemoteFileSubSystem ss,
IContainer folder)
-
downloadResourceToWorkspace
public static
Object downloadResourceToWorkspace(
File srcFileOrFolder,
IProgressMonitor monitor)
-
-
Since:
- 3.0
downloadFileToWorkspace
protected static
IFile downloadFileToWorkspace(
File srcFileOrFolder,
IProgressMonitor monitor)
- Replicates a local file to the temporary files project in the workspace.
-
-
Parameters:
-
srcFileOrFolder
- the file to copy. -
monitor
- the progress monitor.
-
Returns:
- the resulting local replica.
-
Since:
- 3.0
download
protected static boolean download(
File file,
IFile tempFile,
String hostEncoding,
IProgressMonitor monitor)
-
downloadResourceToWorkspace
public static
Object downloadResourceToWorkspace(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
- Replicates a remote file or folder to the workspace
-
-
Parameters:
-
srcFileOrFolder
- the object which is being copied -
monitor
- a progress monitor
-
Returns:
- the temporary object that was created after the download
-
Since:
- 3.0
uploadResourceFromWorkspace
public static
Object uploadResourceFromWorkspace(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor)
- Perform a copy via drag and drop.
-
-
Parameters:
-
srcFileOrFolder
- the object to be copied. If the target and source are not on the same system, then this is a
temporary object produced by the doDrag. -
targetFolder
- the object to be copied to. -
monitor
- the progress monitor
-
Returns:
- the resulting remote object
-
Since:
- 3.0
uploadResourcesFromWorkspace
public static
SystemRemoteResourceSet uploadResourcesFromWorkspace(
SystemWorkspaceResourceSet workspaceSet,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
- Perform a copy via drag and drop.
-
-
Parameters:
-
workspaceSet
- the objects to be copied. If the target and sources are not on the same system, then this is a
temporary object produced by the doDrag. -
targetFolder
- the object to be copied to. -
monitor
- the progress monitor -
checkForCollisions
- indicates whether to check for colllisions or not
-
Returns:
- the resulting remote objects
-
Since:
- 3.0
uploadResourceFromWorkspace
public static
Object uploadResourceFromWorkspace(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
- Perform a copy via drag and drop.
-
-
Parameters:
-
srcFileOrFolder
- the object to be copied. If the target and source are not on the same system, then this is a
temporary object produced by the doDrag. -
targetFolder
- the object to be copied to. -
monitor
- the progress monitor -
checkForCollisions
- indicates whether to check for colllisions or not
-
Returns:
- the result remote object
-
Since:
- 3.0
compressedUploadFromWorkspace
public static void compressedUploadFromWorkspace(
IContainer directory,
IRemoteFile newTargetFolder,
IProgressMonitor monitor)
throws
Exception
-
-
Throws:
-
Exception
-
Since:
- 3.0
setReadOnly
protected static void setReadOnly(
IFile file,
boolean flag)
-
transferProperties
public static void transferProperties(
IResource source,
IRemoteFile target,
IProgressMonitor monitor)
throws
CoreException,
RemoteFileSecurityException,
RemoteFileIOException,
SystemMessageException
-
-
Throws:
-
CoreException
-
RemoteFileSecurityException
-
RemoteFileIOException
-
SystemMessageException
getArchiveExtensionFromProperties
protected static
String getArchiveExtensionFromProperties()
-
compressedDownloadToWorkspace
public static
IResource compressedDownloadToWorkspace(
IRemoteFile directory,
IProgressMonitor monitor)
throws
Exception
-
-
Throws:
-
Exception
-
Since:
- 3.0
cleanup
protected static void cleanup(
IRemoteFile arc1,
File arc2)
throws
RemoteFileIOException,
RemoteFileSecurityException,
RemoteFolderNotEmptyException
-
-
Throws:
-
RemoteFileIOException
-
RemoteFileSecurityException
-
RemoteFolderNotEmptyException
useLocalSeparator
protected static
String useLocalSeparator(
String virtualPath)
-
getTempFileFor
public static
IResource getTempFileFor(
IRemoteFile srcFileOrFolder)
- Returns the corresponding temp file location for a remote file or folder
-
-
Parameters:
-
srcFileOrFolder
- the remote file or folder
-
Returns:
- the local replica location
normalizePath
protected static
String normalizePath(
String localpath,
char rmtSeparator)
-
getTempFileFor
public static
IResource getTempFileFor(
File srcFileOrFolder)
- Returns the corresponding temp file location for a local file or folder.
-
-
Parameters:
-
srcFileOrFolder
- the local file or folder.
-
Returns:
- the local replica location.
getActualHostFor
public static
String getActualHostFor(
IRemoteFileSubSystem subsystem,
String remotePath)
-
-
Since:
- 3.0
getActualHostFor
public static
String getActualHostFor(
String hostname,
String remotePath,
IRemoteFileSubSystem subsystem)
-
-
Since:
- 3.0
isRemoteFileMounted
protected static boolean isRemoteFileMounted(
ISubSystem subsystem,
String remotePath)
-
isRemoteFileMounted
protected static boolean isRemoteFileMounted(
String hostname,
String remotePath,
IRemoteFileSubSystem subsystem)
-
-
Since:
- 3.0
getWorkspaceRemotePath
protected static
String getWorkspaceRemotePath(
IRemoteFileSubSystem subsystem,
String remotePath)
-
-
Since:
- 3.0
getWorkspaceRemotePath
protected static
String getWorkspaceRemotePath(
String hostname,
String remotePath,
IRemoteFileSubSystem subsystem)
-
-
Since:
- 3.0
checkForCollision
protected static
UniversalFileTransferUtility.RenameStatus checkForCollision(
SystemRemoteResourceSet existingFiles,
IRemoteFile targetFolder,
String oldName,
String oldPath)
-
checkForCollision
protected static
UniversalFileTransferUtility.RenameStatus checkForCollision(
SystemRemoteResourceSet existingFiles,
IRemoteFile targetFolder,
String oldName,
String oldPath,
List NamesInUse)
-
-
Since:
- 3.0
checkForCollision
protected static boolean checkForCollision(
SystemRemoteResourceSet existingFiles,
IRemoteFile targetFolder,
String oldPath)
-
-
Since:
- 3.0
checkForCollision
protected static
String checkForCollision(
IRemoteFile targetFolder,
String oldName)
-
copyRemoteFileToWorkspace
protected static
IFile copyRemoteFileToWorkspace(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
-
Deprecated. use downloadFileToWorkspace
- replicates a remote file to the temp files project in the workspace
-
-
Parameters:
-
srcFileOrFolder
- the file to copy -
monitor
- the progress monitor
-
Returns:
- the resulting local replica
copyRemoteResourcesToWorkspaceMultiple
public static
SystemWorkspaceResourceSet copyRemoteResourcesToWorkspaceMultiple(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
-
Deprecated. use downloadResourcesToWorkspaceMultiple
- This method downloads a set of remote resources to the workspace. It uses
the downloadMultiple() API of the remote file subsystem and service layers so
for some service implementations, this is a big optimization
-
-
Parameters:
-
remoteSet
- the set of resources to download -
monitor
- the progress monitor
-
Returns:
- the set of temp files created as a result of the download.
-
Since:
- 3.0
copyRemoteResourcesToWorkspace
public static
SystemWorkspaceResourceSet copyRemoteResourcesToWorkspace(
SystemRemoteResourceSet remoteSet,
IProgressMonitor monitor)
-
Deprecated. use downloadResourcesToWorkspace
- Replicates a set of remote files or folders to the workspace
-
-
Parameters:
-
remoteSet
- the objects which are being copied -
monitor
- a progress monitor
-
Returns:
- the temporary objects that was created after the download
copyRemoteResourceToWorkspace
public static
Object copyRemoteResourceToWorkspace(
File srcFileOrFolder,
IProgressMonitor monitor)
-
Deprecated. use downloadResourceToWorkspace
-
copyRemoteFileToWorkspace
protected static
IFile copyRemoteFileToWorkspace(
File srcFileOrFolder,
IProgressMonitor monitor)
-
Deprecated. use downloadFileToWorkspace
- Replicates a local file to the temp files project in the workspace.
-
-
Parameters:
-
srcFileOrFolder
- the file to copy. -
monitor
- the progress monitor.
-
Returns:
- the resulting local replica.
copyRemoteResourceToWorkspace
public static
Object copyRemoteResourceToWorkspace(
IRemoteFile srcFileOrFolder,
IProgressMonitor monitor)
-
Deprecated. use downloadResourceToWorkspace
- Replicates a remote file or folder to the workspace
-
-
Parameters:
-
srcFileOrFolder
- the object which is being copied -
monitor
- a progress monitor
-
Returns:
- the temporary object that was created after the download
copyWorkspaceResourceToRemote
public static
Object copyWorkspaceResourceToRemote(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor)
-
Deprecated. use uploadResourceFromWorkspace
- Perform a copy via drag and drop.
-
-
Parameters:
-
srcFileOrFolder
- the object to be copied. If the target and source are not on the same system, then this is a
temporary object produced by the doDrag. -
targetFolder
- the object to be copied to. -
monitor
- the progress monitor
-
Returns:
- the resulting remote object
copyWorkspaceResourcesToRemote
public static
SystemRemoteResourceSet copyWorkspaceResourcesToRemote(
SystemWorkspaceResourceSet workspaceSet,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
-
Deprecated. use uploadResourcesFromWorkspace
- Perform a copy via drag and drop.
-
-
Parameters:
-
workspaceSet
- the objects to be copied. If the target and sources are not on the same system, then this is a
temporary object produced by the doDrag. -
targetFolder
- the object to be copied to. -
monitor
- the progress monitor -
checkForCollisions
- indicates whether to check for collisions or not
-
Returns:
- the resulting remote objects
copyWorkspaceResourceToRemote
public static
Object copyWorkspaceResourceToRemote(
IResource srcFileOrFolder,
IRemoteFile targetFolder,
IProgressMonitor monitor,
boolean checkForCollisions)
-
Deprecated. use uploadResourceFromWorkspace
- Perform a copy via drag and drop.
-
-
Parameters:
-
srcFileOrFolder
- the object to be copied. If the target and source are not on the same system, then this is a
temporary object produced by the doDrag. -
targetFolder
- the object to be copied to. -
monitor
- the progress monitor -
checkForCollisions
- indicates whether to check for collisions or not
-
Returns:
- the result remote object
compressedCopyWorkspaceResourceToRemote
public static void compressedCopyWorkspaceResourceToRemote(
IContainer directory,
IRemoteFile newTargetFolder,
IProgressMonitor monitor)
throws
Exception
-
Deprecated. use compressedUploadFromWorkspace
-
-
Parameters:
-
directory
- -
newTargetFolder
- -
monitor
-
-
Throws:
-
Exception
compressedCopyRemoteResourceToWorkspace
public static
IResource compressedCopyRemoteResourceToWorkspace(
IRemoteFile directory,
IProgressMonitor monitor)
throws
Exception
-
Deprecated. use compressedDownloadToWorkspace
-
-
Parameters:
-
directory
- -
monitor
-
-
Returns:
-
-
Throws:
-
Exception
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.