RSE
Release 3.0

org.eclipse.rse.core
Class SystemResourceManager

java.lang.Object
  extended by org.eclipse.rse.core.SystemResourceManager

public class SystemResourceManager
extends Object

Static methods that manage the workbench resource tree for the remote systems project. All code in the framework uses this to access the file system for save/restore purposes. By limiting all access to one place, we simply changes should we decide to change the underlying file system map.

Assumptions


Constructor Summary
SystemResourceManager()
           
 
Method Summary
static String addPathTerminator(String path)
          Ensure given path ends with path separator.
static void addResourceChangeListener(IResourceChangeListener l)
          Register a listener for resource change events on objects in our remote system project.
static void deleteFile(IFolder folder, String fileName)
          Delete a file
static void deleteFolder(IFolder folder)
          Delete a folder
static void endResourceEventListening()
          End event listening.
static void ensureOnResourceEventListening()
          Ensure event listening is on.
static String getFolderName(IHost conn)
          Map a system connection object to a folder name
static String getFolderName(ISubSystemConfiguration ssFactory)
          Map a subsystem factory object to a folder name
static String getFolderName(ISystemFilterPool pool)
          Map a filter pool name to a folder name Current algorith is that pool name equals folder name, but we use this method to allow flexibility in the future.
static String getFolderPath(IFolder folder)
          Given any folder, return its path as a string.
static String getFolderPathWithTerminator(IFolder folder)
          Given any folder, return its path as a string, and an ending '\'
static String getProfileName(ISystemFilterPoolManager mgr)
          Map a filter pool manager name to a profile name Current algorith is that manager name equals profile name, but we use this method to allow flexibility in the future.
static String getProfileName(ISystemHostPool pool)
          Map a connection pool name to a profile name.
static IProject getRemoteSystemsProject(boolean force)
          Get the default remote systems project.
static IProject getRemoteSystemsTempFilesProject()
          Get the default remote systems temp files project.
protected static SystemResourceHelpers getResourceHelpers()
          Return singleton of resource helpers object
static void removeResourceChangeListener(IResourceChangeListener l)
          Remove a listener for resource change events on an object in our remote system project.
static void renameFile(IFolder folder, String oldName, String newName)
          Rename a file
static void renameFolder(IFolder folder, String newName)
          Rename a folder
static void startResourceEventListening(ISystemResourceListener listener)
          Start event listening.
static boolean testIfResourceInUse(IResource resource)
          Test if a resource is in use, prior to attempting to rename or delete it.
static void turnOffResourceEventListening()
          Turn off event listening.
static void turnOnResourceEventListening()
          Turn off event listening.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemResourceManager

public SystemResourceManager()
Method Detail

turnOffResourceEventListening

public static void turnOffResourceEventListening()
Turn off event listening. Please call this before do anything that modifies resources and turn it on again after.


turnOnResourceEventListening

public static void turnOnResourceEventListening()
Turn off event listening. Please call this after modifying resources.


ensureOnResourceEventListening

public static void ensureOnResourceEventListening()
Ensure event listening is on. Called at start of team synch action to be safe.


startResourceEventListening

public static void startResourceEventListening(ISystemResourceListener listener)
Start event listening. Requests to turn on and off are ignored until this is called, which is at the appropriate point in the startup sequence.


endResourceEventListening

public static void endResourceEventListening()
End event listening. Requests to turn on and off are ignored after this is called, which is at the appropriate point in the shutdown sequence.


addResourceChangeListener

public static void addResourceChangeListener(IResourceChangeListener l)
Register a listener for resource change events on objects in our remote system project. No attempt is made to filter the events, they are simply passed on and the listener can decide if the event applies to them or not.

However, the event will only be fired if a change is made to that resource outside of the normal activities of the Remote Systems Framework, and only for resources within the Remote Systems Connection project.


removeResourceChangeListener

public static void removeResourceChangeListener(IResourceChangeListener l)
Remove a listener for resource change events on an object in our remote system project.


getRemoteSystemsProject

public static IProject getRemoteSystemsProject(boolean force)
Get the default remote systems project. If found but closed, this will open the project.

Parameters:
force - if true force the creation of the project if not found. In any case, returns handle to the project.
Returns:
IProject handle of the project. Clients should use exists() or isAccessible() to test existence.

getRemoteSystemsTempFilesProject

public static IProject getRemoteSystemsTempFilesProject()
Get the default remote systems temp files project.

Returns:
IProject handle of the project. Use exists() to test existence.

renameFolder

public static void renameFolder(IFolder folder,
                                String newName)
Rename a folder


deleteFolder

public static void deleteFolder(IFolder folder)
Delete a folder


renameFile

public static void renameFile(IFolder folder,
                              String oldName,
                              String newName)
Rename a file


deleteFile

public static void deleteFile(IFolder folder,
                              String fileName)
Delete a file


getProfileName

public static String getProfileName(ISystemHostPool pool)
Map a connection pool name to a profile name. Current algorith is that pool name equals profile name, but we use this method to allow flexibility in the future.


getProfileName

public static String getProfileName(ISystemFilterPoolManager mgr)
Map a filter pool manager name to a profile name Current algorith is that manager name equals profile name, but we use this method to allow flexibility in the future.


getFolderName

public static String getFolderName(ISystemFilterPool pool)
Map a filter pool name to a folder name Current algorith is that pool name equals folder name, but we use this method to allow flexibility in the future.


getFolderName

public static String getFolderName(IHost conn)
Map a system connection object to a folder name


getFolderName

public static String getFolderName(ISubSystemConfiguration ssFactory)
Map a subsystem factory object to a folder name


getFolderPath

public static String getFolderPath(IFolder folder)
Given any folder, return its path as a string.


getFolderPathWithTerminator

public static String getFolderPathWithTerminator(IFolder folder)
Given any folder, return its path as a string, and an ending '\'


getResourceHelpers

protected static SystemResourceHelpers getResourceHelpers()
Return singleton of resource helpers object


addPathTerminator

public static String addPathTerminator(String path)
Ensure given path ends with path separator.


testIfResourceInUse

public static boolean testIfResourceInUse(IResource resource)
Test if a resource is in use, prior to attempting to rename or delete it.

Returns:
true if it is in use or read only, false if it is not.

RSE
Release 3.0

Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.