edu.unh.sdb.common
Class WorkSpaceManager

java.lang.Object
  extended by edu.unh.sdb.common.WorkSpaceManager

public abstract class WorkSpaceManager
extends java.lang.Object

The WorkSpaceManager class is an abstract class meant to be used in a static context only. It maintains a list of of WorkSpaces in its own internal data structures, and maintains a "current" WorkSpace. Since this class is static, the current WorkSpace can be retrieved from anywhere in a program using code like: WorkSpaceManager.getCurrentWorkSpace(); Any other method of this class can be accessed similarly. BUGS: The static mechanism may not work well with multi-threaded programs.


Constructor Summary
WorkSpaceManager()
           
 
Method Summary
static WorkSpace getCurrentWorkSpace()
          Return the current WorkSpace, or null if no current WorkSpace has been set.
static WorkSpace getWorkSpace(URL url)
          Return the WorkSpace with the given name.
static void main(java.lang.String[] args)
          For debugging and testing.
static boolean registerWorkSpace(WorkSpace ws)
          Enter the given WorkSpace into the WorkSpaceManager's internal data structures.
static boolean setCurrentWorkSpace(java.lang.String wsName)
          Set the current WorkSpace to the WorkSpace with the given name.
static void setCurrentWorkSpace(WorkSpace ws)
          Set the current WorkSpace to the given WorkSpace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkSpaceManager

public WorkSpaceManager()
Method Detail

setCurrentWorkSpace

public static boolean setCurrentWorkSpace(java.lang.String wsName)
Set the current WorkSpace to the WorkSpace with the given name. If the manager knows of such a WorkSpace, this method will return true. However, if the manager does not find a WorkSpace with the given name in its internal data structures, it will return false, and leave the current WorkSpace unchanged.


setCurrentWorkSpace

public static void setCurrentWorkSpace(WorkSpace ws)
Set the current WorkSpace to the given WorkSpace. This method will also register an unregistered WorkSpace with the WorkSpaceManager.


getCurrentWorkSpace

public static WorkSpace getCurrentWorkSpace()
Return the current WorkSpace, or null if no current WorkSpace has been set.


getWorkSpace

public static WorkSpace getWorkSpace(URL url)
                              throws java.lang.Exception
Return the WorkSpace with the given name.

Throws:
java.lang.Exception

registerWorkSpace

public static boolean registerWorkSpace(WorkSpace ws)
Enter the given WorkSpace into the WorkSpaceManager's internal data structures. If a WorkSpace with the same name is already registered, then no action is taken, and this method returns false. Otherwise, the given WorkSpace is registered, and this method returns true.


main

public static void main(java.lang.String[] args)
For debugging and testing.