Class ManagerProxy

java.lang.Object
hec.clientapp.model.ManagerProxy
All Implemented Interfaces:
Serializable

public class ManagerProxy extends Object implements Serializable
Container for a Manager so that the application can see what Manager's are out there without having to load all the Manager's data. Manager is held by a WeakReference
See Also:
  • Field Details

    • _className

      protected String _className
      the class name of the Manager
    • _managerRef

      protected transient WeakReference _managerRef
      reference to the Manager
    • _id

      protected Identifier _id
      Identifier specifing where the Manager's file resides
    • _Workspace

      protected mil.army.usace.hec.rmi.server.RemoteWrapper _Workspace
      The remote Workspace
    • _proxyList

      protected transient ManagerProxyList _proxyList
      this ManagerProxy's ProxyList
    • observerCount

      protected transient int observerCount
    • _lastModifiedTime

      protected long _lastModifiedTime
      Time Manager was last modified.
    • _index

      protected int _index
      The unique index of this ManagerProxy/Manager
  • Constructor Details

    • ManagerProxy

      public ManagerProxy()
      Create a new ManagerProxy object
    • ManagerProxy

      public ManagerProxy(Identifier id)
      Create a new ManagerProxy object
      Parameters:
      id - The Identifier to use
    • ManagerProxy

      public ManagerProxy(String className, Identifier id)
      Create a new ManagerProxy object
      Parameters:
      className - the class name of the Manager
      id - the Identifier to use
    • ManagerProxy

      public ManagerProxy(ManagerProxy proxy)
      Create a new ManagerProxy object
      Parameters:
      proxy - the ManagerProxy to copy from
  • Method Details

    • setIndex

      public void setIndex(int idx)
      Sets the Index of the ManagerProxy object
      Parameters:
      idx - The new Index value
    • getIndex

      public int getIndex()
      Gets the Index of the ManagerProxy object
      Returns:
      The Index value
    • setClassName

      public void setClassName(String className)
      Sets the Manager's Class Name of the ManagerProxy object
      Parameters:
      className - The new Class Name value
    • getClassName

      public String getClassName()
      Gets the Class Name of the Manager
      Returns:
      The ClassName value
    • setWorkspace

      public void setWorkspace(mil.army.usace.hec.rmi.server.RemoteWrapper wkspWrap)
      Sets the Workspace of the ManagerProxy object
      Parameters:
      wkspWrap - The new Workspace value
    • getWorkspace

      public mil.army.usace.hec.rmi.server.RemoteWrapper getWorkspace()
      Gets the Workspace of the ManagerProxy object
      Returns:
      The Workspace value
    • setProxyList

      public void setProxyList(ManagerProxyList pl)
      Sets the ManagerProxyList of the ManagerProxy object
      Parameters:
      pl - The new ProxyList value
    • getProxyList

      public ManagerProxyList getProxyList()
      Gets the ManagerProxyList of the ManagerProxy object
      Returns:
      The ProxyList value
    • getId

      public Identifier getId()
      Gets the Identifier of the ManagerProxy object
      Returns:
      The Identifier
    • setId

      public void setId(Identifier id)
      Sets the Identifier of the ManagerProxy object
      Parameters:
      id - The new Identifier value
    • getRun

      public Object getRun()
      Returns:
      The Run value
    • getName

      public String getName()
      Gets the Name of the ManagerProxy object
      Returns:
      The Name value
    • getDescription

      public String getDescription()
      Gets the Description of the ManagerProxy object
      Returns:
      The Description value
    • getPath

      public String getPath()
      Gets the Path of the ManagerProxy object
      Returns:
      The Path value
    • getManager

      public Manager getManager()
      Gets the Manager of the ManagerProxy object. if the Manager isn't already loaded this method won't load it. Normally loadManager() should be used
      Returns:
      The Manager value
    • loadManager

      public Manager loadManager(String classname, Identifier id)
      load the Manager. If the Manager is already loaded then just return it.
      Parameters:
      classname - the class name of the Manager. Normally null
      id - the Identifier of the Manager's file. Normally null
      Returns:
      The Manager held by this ManagerProxy
    • deleteManager

      public void deleteManager()
      called by the RmiWorkspace when the manager is being deleted.
    • renameManager

      public void renameManager(Identifier id)
      rename the Manager held by this ManagerProxy. If the Manager is loaded then it's renamed(Identifier) method is called
      Parameters:
      id - the Identifier to rename the Manager to
    • dropManager

      public boolean dropManager()
      drop the Reference to the ManagerProxy's Manager
      Returns:
      true.
    • setManager

      public void setManager(Manager m)
      Sets the Manager of the ManagerProxy object
      Parameters:
      m - The new Manager
    • unloadManager

      public void unloadManager()
      unload the Manager from Memory
    • closeWorkspace

      public void closeWorkspace()
    • saveManager

      public boolean saveManager()
      Save the Manager. If the Manager isn't loaded then do nothing
      Returns:
      true if the Manager was successfully loaded
    • saveManager

      public boolean saveManager(Manager newManager, Identifier id)
      Save the Manager
      Parameters:
      newManager - the Manager to Save. Normally null
      id - the Identifier to save to. Normally null
      Returns:
      true if the Manager is saved successfully
    • saveAsManager

      public boolean saveAsManager(Manager newManager, Identifier id)
      save this Manager to a new location/name
      Parameters:
      newManager - the new Manager
      id - the new Identifier
      Returns:
      true if the save was successful
    • represents

      public boolean represents(String className)
      see if the ManagerProxy's Manager is the same class as className
      Parameters:
      className - the class name
      Returns:
      true if the Manager's class is the same type as classname
    • setLastModifiedTime

      public void setLastModifiedTime(long lastModifiedTime)
      Sets the LastModifiedTime of the ManagerProxy object
      Parameters:
      lastModifiedTime - The new LastModifiedTime value
    • getLastModifiedTime

      public long getLastModifiedTime()
      return the last modified time, if the manager is instanciated then return it's modified time. Otherwise ask the rmi workspace to get the modified time from it's manangerProxy.
      Returns:
      The LastModifiedTime value
    • getRmiLastModifiedTime

      public long getRmiLastModifiedTime()
      called from the rmi workspace to get the Manager's last modified time
      Returns:
      The LastModifiedTime value
    • write

      public void write(BufferedWriter out) throws IOException
      write this manager proxy out to the file
      Parameters:
      out - Description
      Throws:
      IOException - Description
    • toString

      public String toString()
      return the String representation of this ManagerProxyl
      Overrides:
      toString in class Object
      Returns:
      the ManagerProxy's name
    • equals

      public boolean equals(Object that)
      see if the ManagerProxy equals that
      Overrides:
      equals in class Object
      Parameters:
      that - the object being compared to
      Returns:
      if that is equal to this
    • equals

      public boolean equals(ManagerProxy that)
      see if the ManagerProxy equals that. Considered equal if the index and classname match
      Parameters:
      that - Description
      Returns:
      true if the index and the classname match
    • hashCode

      public int hashCode()
      return the hashcode for the ManagerProxy
      Overrides:
      hashCode in class Object
      Returns:
      the Manager's index
    • getObserverCount

      public int getObserverCount()
      Returns:
      The ObserverCount value
    • hasBeenGCd

      public boolean hasBeenGCd()
    • setUserInterface

      public void setUserInterface(UserInterface ui)
      Parameters:
      frame -