Class StateManager

All Implemented Interfaces:
Constants, ActionListener, EventListener, HyperlinkListener, IdvConstants

public class StateManager extends StateManager implements Constants, HyperlinkListener
This class is used to initialize McIDAS-V.

The initialization process includes creating an "object store" (for preferences), user-modifiable settings, and so on.

McIDAS-V uses this class to perform pretty much all version-check operations.

  • Field Details

  • Constructor Details

  • Method Details

    • doMakeObjectStore

      Override to set the right user directory.
      Overrides:
      doMakeObjectStore in class StateManager
      Returns:
      Newly created object store.
    • initObjectStore

      protected void initObjectStore(IdvObjectStore store)
      Initialize the given object store. This mostly initializes the user's "userpath" directory when it is first created.
      Overrides:
      initObjectStore in class StateManager
      Parameters:
      store - Object store to initialize. Cannot be null.
    • initUserDirectory

      protected void initUserDirectory(File directory)
      Initialize the McIDAS-V user directory (if it is not already initalized).

      Here, initialization means "the user directory exists, and contains a barebones version of mcidasv.rbi".

      Overrides:
      initUserDirectory in class StateManager
      Parameters:
      directory - McIDAS-V user directory. Cannot be null.
    • initState

      protected void initState(boolean interactiveMode)
      Description copied from class: ucar.unidata.idv.StateManager
      Initialize the store, properties and IdvResourceManager
      Overrides:
      initState in class StateManager
      Parameters:
      interactiveMode - Is the idv in interactive mode (the default)
    • removeDisabledControlDescriptors

      Removes disabled ControlDescriptors from IntegratedDataViewer's controlDescriptors and controlDescriptorMap fields.
    • hyperlinkUpdate

      Handle a change to a link.
      Specified by:
      hyperlinkUpdate in interface HyperlinkListener
      Parameters:
      e - Link event. Cannot be null.
    • click

      public void click(String url)
      Handle a click on a link.
      Parameters:
      url - Link to visit.
    • getOSName

      public String getOSName()
      Get the name of the current operating system (via "os.name" system property).

      Note: all space characters will be replaced with underscores.

      Returns:
      Operating system name.
    • getMcIdasVersionAbout

    • getMcIdasVersion

    • getJythonVersion

      Returns the current Jython version.
      Overrides:
      getJythonVersion in class StateManager
      Returns:
      Jython's version information.
    • getProperty

      public Object getProperty(String name)
      Get a property.
      Overrides:
      getProperty in class StateManager
      Parameters:
      name - Name of the property. Cannot be null.
      Returns:
      Value associated with name or null.
    • getPropertyOrPreference

      Find the value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.
      Parameters:
      name - Property or preference ID. Cannot be null.
      Returns:
      Either the value associated with name or null.
    • getPropertyOrPreference

      Find the String value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.
      Parameters:
      name - Property or preference ID. Cannot be null.
      dflt - Value to return if there is no property or preference associated with name
      Returns:
      Either the value associated with name or dflt.
    • getPropertyOrPreference

      public int getPropertyOrPreference(String name, int dflt)
      Find the Integer value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.
      Parameters:
      name - Property or preference ID. Cannot be null.
      dflt - Value to return if there is no property or preference associated with name
      Returns:
      Either the value associated with name or dflt.
    • getPropertyOrPreference

      public double getPropertyOrPreference(String name, double dflt)
      Find the Double value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.
      Parameters:
      name - Property or preference ID. Cannot be null.
      dflt - Value to return if there is no property or preference associated with name
      Returns:
      Either the value associated with name or dflt.
    • getPropertyOrPreference

      public boolean getPropertyOrPreference(String name, boolean dflt)
      Find the Boolean value associated with the given ID by checking the "properties", and if nothing was found, check the preferences.
      Parameters:
      name - Property or preference ID. Cannot be null.
      dflt - Value to return if there is no property or preference associated with name
      Returns:
      Either the value associated with name or dflt.
    • getVersionInfo

      Returns information about the current version of McIDAS-V and the IDV, along with their respective build dates.
      Returns:
      Hashtable containing versioning information.
    • getNetcdfDate

      Return the timestamp from when ncIdv.jar was created.
      Returns:
      String representation of the creation timestamp.
    • getNetcdfVersion

      Return the version information within ncIdv.jar.
      Returns:
      Version of ncIdv.jar shipped by McIDAS-V.
    • getVisadDate

      public String getVisadDate()
      Return the timestamp from when visad.jar was created.
      Returns:
      String representation of the creation timestamp. Likely to change formatting over time.
    • getVisadVersion

      Return the "version" of VisAD.
      Returns:
      Currently returns whatever the SVN revision number was when visad.jar was built.
    • getIdvVersion

    • getStoreSystemName

      Overridden to set default of McIDAS-V
      Overrides:
      getStoreSystemName in class StateManager
      Returns:
      The system name
    • getStoreName

      public String getStoreName()
      Overridden to get dir of the unnecessary second level directory.
      Overrides:
      getStoreName in class StateManager
      Returns:
      The name of the store. This ends up being the name of the subdirectory of the ~/.unidata/idv base directory.
    • getMcIdasVersionStable

      Connect to McIDAS-V website and look for latest stable version.
      Returns:
      Latest stable version.
    • getMcIdasVersionPrerelease

      Connect to McIDAS-V website and look for latest pre-release version.
      Returns:
      Latest pre-release version.
    • getNoticeLatest

      Connect to McIDAS website and look for latest notice.
      Returns:
      Contents of notice. String may be empty.
    • compareVersions

      public static int compareVersions(String thisVersion, String thatVersion)
      Compare version strings.

      The logic is as follows.

          0: thisVersion and thatVersion are equal.
         <0: thisVersion is greater.
         >0: thatVersion is greater.
       
      Parameters:
      thisVersion - First version string to compare.
      thatVersion - Second version string to compare.
      Returns:
      Value indicating which of thisVersion and thatVersion is "greater".
    • versionToInteger

      public static int versionToInteger(String version)
      Turn version strings of the form #.#(a#), where # is one or two digits, a is one of alpha or beta, and () is optional, into an integer value... (empty) > beta > alpha.
      Parameters:
      version - String representation of version number.
      Returns:
      Integer representation of version.
    • getIsPrerelease

      public boolean getIsPrerelease()
    • checkForNewerVersion

      public void checkForNewerVersion(boolean notifyDialog)
    • checkForNewerVersionStable

      public void checkForNewerVersionStable(boolean notifyDialog)
    • checkForNewerVersionPrerelease

      public void checkForNewerVersionPrerelease(boolean notifyDialog)
    • checkForNotice

      public void checkForNotice(boolean notifyDialog)
    • debugNotice

      public void debugNotice(String noticeContents, boolean notifyDialog, boolean disableCache)
      Debug a McIDAS-V "system notice" before sending it to all users!
      Parameters:
      noticeContents - Contents of the notice.
      notifyDialog - if true, show notice even if already seen.
      disableCache - Whether or not noticeContents will be cached.
    • getNoticePath

      private String getNoticePath()
    • getNoticeCached

    • setNoticeCached

      private void setNoticeCached(String notice)