public class EntryStore extends java.lang.Object
AddeThread| Modifier and Type | Class and Description | 
|---|---|
| static class  | EntryStore.EventEnumeration of the various server manager events. | 
| Modifier and Type | Field and Description | 
|---|---|
| private java.lang.String | ADDE_BINPath to local server binaries. | 
| private java.lang.String | ADDE_DATAPath to local server data. | 
| private java.lang.String | ADDE_DIRECTORY"Root" local server directory. | 
| private java.lang.String | ADDE_MCSERVLPath to mcservl. | 
| private java.lang.String | ADDE_RESOLVPath to the user's "RESOLV.SRV". | 
| private static java.lang.String | ERROR_LOGUTIL_USERPATH"Userpath" not writable error message. | 
| private static java.lang.String | ERROR_USERPATH"Userpath" not writable error message. | 
| private ucar.unidata.idv.IdvObjectStore | idvStoreMcIDAS-V preferences store. | 
| private java.util.List<AddeEntry> | lastAddedLast  AddeEntriesadded to the manager. | 
| private static java.lang.String | localPortWhich port is this particular manager operating on | 
| private static org.slf4j.Logger | loggerLogging object. | 
| private java.lang.String | MCTRACEValue of "MCTRACE" environment variable for mcservl. | 
| private static java.lang.String | PREF_ADDE_ENTRIESPreference key for ADDE entries. | 
| private static java.lang.String | PROP_DEBUG_ADDEURLProperty that allows users to control debug output from ADDE requests. | 
| private static java.lang.String | PROP_DEBUG_LOCALROOTProperty that allows users to supply arbitrary paths to McIDAS-X 
 binaries used by mcservl. | 
| private static AddeThread | threadThread that monitors the mcservl process. | 
| private PatriciaTrie<java.lang.String,AddeEntry> | trieThe ADDE servers known to McIDAS-V. | 
| private java.lang.String | USER_DIRECTORYPath to the user's "userpath" directory. | 
| private static java.lang.String | WARN_NO_RESOLVSRVSLF4J-style formatting string for use when  RESOLV.SRVcan not
 be found. . | 
| Constructor and Description | 
|---|
| EntryStore(ucar.unidata.idv.IdvObjectStore store,
          ucar.unidata.idv.IdvResourceManager rscManager)Constructs a server manager. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addEntries(java.util.Collection<? extends AddeEntry> newEntries) | 
| void | addEntry(AddeEntry entry) | 
| boolean | checkLocalServer()Check to see if the thread is running. | 
| private java.util.Set<AddeEntry> | extractPreferencesEntries(ucar.unidata.idv.IdvObjectStore store)Returns the  AddeEntriesstored in the user's
 preferences. | 
| private java.util.Set<AddeEntry> | extractResourceEntries(AddeEntry.EntrySource source,
                      ucar.unidata.xml.XmlResourceCollection xmlResources)Process all of the "IDV-style" XML resources for a given
 "source". | 
| private java.util.Set<AddeEntry> | extractUserEntries(ucar.unidata.xml.XmlResourceCollection xmlResources)Process all of the "user" XML resources. | 
| private java.util.Set<LocalAddeEntry> | filterLocalEntriesByTemporaryStatus(boolean getTemporaryEntries)Filters the local entries by whether or not they are set as
 "temporary". | 
| AddeAccount | getAccountingFor(ucar.unidata.idv.chooser.adde.AddeServer idvServer,
                java.lang.String typeAsStr)Returns the accounting for the given  idvServerandtypeAsStr. | 
| AddeAccount | getAccountingFor(java.lang.String address,
                java.lang.String group,
                AddeEntry.EntryType type)Searches the set of servers in an attempt to locate the accounting 
 information for the matching server. | 
| protected java.lang.String[] | getAddeCommands()Returns command line used to launch mcservl. | 
| static java.lang.String | getAddeRootDirectory()Returns the path to where the root directory of the user's McIDAS-X 
 binaries should be. | 
| java.util.Set<java.lang.String> | getAddresses() | 
| java.util.Set<AddeEntry> | getEntrySet()Returns the complete  SetofAddeEntries. | 
| java.util.Set<java.lang.String> | getGroups(java.lang.String address)Returns the  Setof "groups" associated with the 
 givenaddress. | 
| java.util.Set<java.lang.String> | getGroupsFor(java.lang.String address,
            AddeEntry.EntryType type) | 
| ucar.unidata.idv.IdvObjectStore | getIdvStore()Returns the  IdvObjectStoreused to save user preferences. | 
| java.util.List<ucar.unidata.idv.chooser.adde.AddeServer> | getIdvStyleEntries()Returns a list of all available ADDE datasets, converted to IDV 
  AddeServerobjects. | 
| java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer> | getIdvStyleEntries(AddeEntry.EntryType type)Returns a list that consists of the available ADDE datasets for a given 
  AddeEntry.EntryType, converted to IDVAddeServerobjects. | 
| java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer> | getIdvStyleEntries(java.lang.String typeAsStr)Returns a list that consists of the available ADDE datasets for a given 
  AddeEntry.EntryType, converted to IDVAddeServerobjects. | 
| java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer.Group> | getIdvStyleLocalGroups()Returns all enabled, valid  LocalAddeEntriesas a
 collection of "IDV style"AddeServer.Groupobjects. | 
| java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer.Group> | getIdvStyleRemoteGroups(java.lang.String server,
                       AddeEntry.EntryType type)Returns the entries matching the given  serverandtypeparameters as a collection ofAddeServer.Groupobjects. | 
| java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer.Group> | getIdvStyleRemoteGroups(java.lang.String server,
                       java.lang.String typeAsStr)Returns the entries matching the given  serverandtypeAsStrparameters as a collection ofAddeServer.Groupobjects. | 
| java.util.List<AddeEntry> | getLastAdded()Returns the  AddeEntriesthat were added last. | 
| java.util.List<AddeEntry> | getLastAddedByType(AddeEntry.EntryType type)Searches the newest entries for the entries of the given
  AddeEntry.EntryType. | 
| java.util.List<AddeEntry> | getLastAddedByTypes(java.util.EnumSet<AddeEntry.EntryType> types)Returns the  AddeEntriesthat were added last, filtered
 by the givenEntryTypes. | 
| java.util.Set<LocalAddeEntry> | getLocalEntries()Returns the complete  SetofLocalAddeEntries. | 
| static java.lang.String | getLocalPort()Ask for the port we are listening on. | 
| java.util.Set<AddeEntry> | getPersistedEntrySet()Returns all non-temporary  AddeEntries. | 
| java.util.Set<LocalAddeEntry> | getPersistedLocalEntries()Returns the  SetofLocalAddeEntriesthat
 will be saved between McIDAS-V sessions. | 
| java.util.Set<RemoteAddeEntry> | getRemoteEntries()Returns the complete  SetofRemoteAddeEntries. | 
| java.util.Set<java.lang.String> | getRemoteEntryTexts() | 
| java.util.Set<LocalAddeEntry> | getTemporaryLocalEntries()Returns any  LocalAddeEntriesthat will be removed
 at the end of the current McIDAS-V session. | 
| java.util.Set<AddeEntry.EntryType> | getTypes(java.lang.String address,
        java.lang.String group) | 
| protected java.lang.String[] | getUnixAddeEnv()Returns environment variables that allow mcservl to run on
 "unix-like" systems. | 
| java.util.Set<AddeEntry> | getVerifiedEntries(AddeEntry.EntryType type) | 
| java.util.Map<AddeEntry.EntryType,java.util.Set<AddeEntry>> | getVerifiedEntriesByTypes()Returns the available  AddeEntries, grouped byAddeEntry.EntryType. | 
| protected java.lang.String[] | getWindowsAddeEnv()Returns environment variables that allow mcservl to run on Windows. | 
| static boolean | isAddeDebugEnabled(boolean defValue)Checks the value of the  debug.adde.reqssystem property to
 determine whether or not the user has requested ADDE URL debugging 
 output. | 
| static boolean | isInvalidEntry(AddeEntry entry)Determine the validity of a given  AddeEntry. | 
| protected static java.lang.String | nextLocalPort()Get the next port by incrementing current port. | 
| void | onEvent(EntryStore.Event evt)Responds to server manager events being passed with the event bus. | 
| private static void | putEntries(PatriciaTrie<java.lang.String,AddeEntry> trie,
          java.util.Collection<? extends AddeEntry> newEntries)Adds  AddeEntryobjects to a givenPatriciaTrie. | 
| private static java.util.Set<AddeEntry> | removeDeletedSystemEntries(java.util.Collection<? extends AddeEntry> entries,
                          java.util.Collection<? extends AddeEntry> systemEntries)Searches  entriesforAddeEntryobjects with two characteristics:
 
 the object source isAddeEntry.EntrySource.SYSTEMthe object is not insystemEntriesThe intent behind this method is to safely remove "system"
 entries that have been stored to a user's preferences. | 
| boolean | removeEntries(java.util.Collection<? extends AddeEntry> removedEntries)Removes the given  AddeEntries. | 
| boolean | removeEntry(AddeEntry entry)Removes a single  AddeEntryfrom the set of available entries. | 
| void | replaceEntries(java.util.Collection<? extends AddeEntry> oldEntries,
              java.util.Collection<? extends AddeEntry> newEntries) | 
| void | saveEntries()Saves the current set of ADDE servers to the user's preferences and
  ADDE_RESOLV. | 
| void | saveForShutdown()Saves the list of ADDE entries to both the user's preferences and
  ADDE_RESOLV. | 
| java.util.List<AddeEntry> | searchWithPrefix(java.lang.String prefix)Search the server manager for entries that match  prefix. | 
| static boolean | setAddeDebugEnabled(boolean value)Sets the value of the  debug.adde.reqssystem property so
 that debugging output can be controlled without restarting McIDAS-V. | 
| static void | setLocalPort(java.lang.String port)Change the port we are listening on. | 
| void | startLocalServer()Starts the local server thread (if it isn't already running). | 
| void | stopLocalServer()Stops the local server thread if it is running. | 
| boolean | testLocalServer()Test to see if the thread can access userpath | 
private static final java.lang.String PROP_DEBUG_LOCALROOT
getAddeRootDirectory(), 
Constant Field Valuesprivate static final java.lang.String PROP_DEBUG_ADDEURL
private static final java.lang.String ERROR_LOGUTIL_USERPATH
LogUtil.userErrorMessage(String).private static final java.lang.String ERROR_USERPATH
private static final java.lang.String WARN_NO_RESOLVSRV
RESOLV.SRV can not
 be found. .private static final org.slf4j.Logger logger
private static final java.lang.String PREF_ADDE_ENTRIES
private final PatriciaTrie<java.lang.String,AddeEntry> trie
private final java.lang.String ADDE_DIRECTORY
private final java.lang.String ADDE_BIN
private final java.lang.String ADDE_DATA
private final java.lang.String ADDE_MCSERVL
private final java.lang.String USER_DIRECTORY
private final java.lang.String ADDE_RESOLV
private final java.lang.String MCTRACE
EntryStore(ucar.unidata.idv.IdvObjectStore, ucar.unidata.idv.IdvResourceManager).private static java.lang.String localPort
private static AddeThread thread
private final java.util.List<AddeEntry> lastAdded
AddeEntries added to the manager.private final ucar.unidata.idv.IdvObjectStore idvStore
public EntryStore(ucar.unidata.idv.IdvObjectStore store, ucar.unidata.idv.IdvResourceManager rscManager)
store - McIDAS-V's preferences store. Cannot be null.rscManager - McIDAS-V's resource manager. Cannot be null.java.lang.NullPointerException - if either of store or
 rscManager is null.private static java.util.Set<AddeEntry> removeDeletedSystemEntries(java.util.Collection<? extends AddeEntry> entries, java.util.Collection<? extends AddeEntry> systemEntries)
entries for AddeEntry objects with two characteristics:
 AddeEntry.EntrySource.SYSTEMsystemEntriesThe intent behind this method is to safely remove "system"
 entries that have been stored to a user's preferences. entries
 can be generated from anywhere you like, but systemEntries should
 almost always be created from "addeservers.xml".
entries - Cannot be null.systemEntries - Cannot be null.Set of entries that are not system resources that have
 been removed, or an empty Set.private static void putEntries(PatriciaTrie<java.lang.String,AddeEntry> trie, java.util.Collection<? extends AddeEntry> newEntries)
AddeEntry objects to a given PatriciaTrie.trie - Cannot be null.newEntries - Cannot be null.public ucar.unidata.idv.IdvObjectStore getIdvStore()
IdvObjectStore used to save user preferences.IdvObjectStore used by the rest of McIDAS-V.protected java.lang.String[] getWindowsAddeEnv()
String array containing mcservl's environment variables.protected java.lang.String[] getUnixAddeEnv()
String array containing mcservl's environment variables.protected java.lang.String[] getAddeCommands()
String array that represents an invocation of mcservl.public static boolean isInvalidEntry(AddeEntry entry)
AddeEntry.entry - Entry to check. Cannot be null.true if entry is invalid or false
 otherwise.java.lang.NullPointerException - if entry is null.java.lang.AssertionError - if entry is somehow neither a
 RemoteAddeEntry or LocalAddeEntry.LocalAddeEntry.INVALID_ENTRY, 
RemoteAddeEntry.INVALID_ENTRYprivate java.util.Set<AddeEntry> extractPreferencesEntries(ucar.unidata.idv.IdvObjectStore store)
AddeEntries stored in the user's
 preferences.store - Object store that represents the user's preferences.
 Cannot be null.AddeEntrys stored in the prefs or an empty
 Set.public void onEvent(EntryStore.Event evt)
evt - Event to which this method is responding. Cannot be
 null.java.lang.NullPointerException - if evt is null.public void saveEntries()
ADDE_RESOLV.public void saveForShutdown()
ADDE_RESOLV.public java.util.List<AddeEntry> getLastAddedByType(AddeEntry.EntryType type)
AddeEntry.EntryType.type - Look for entries matching this EntryType.
 Cannot be null.List of entries or an empty List.java.lang.NullPointerException - if type is null.public java.util.List<AddeEntry> getLastAddedByTypes(java.util.EnumSet<AddeEntry.EntryType> types)
AddeEntries that were added last, filtered
 by the given EntryTypes.types - Filter the last added entries by these entry type.
 Cannot be null.List of the last added entries, filtered by
 types.java.lang.NullPointerException - if types is null.public java.util.List<AddeEntry> getLastAdded()
AddeEntries that were added last. Note
 that this value is not preserved between sessions.List of the last ADDE entries that were added. May be
 empty.public java.util.Set<AddeEntry> getVerifiedEntries(AddeEntry.EntryType type)
type - The EntryType you are interested in. Cannot be
 null.Set of matching remote ADDE entries. If there were no
 matches, an empty Set is returned.java.lang.NullPointerException - if type is null.public java.util.Map<AddeEntry.EntryType,java.util.Set<AddeEntry>> getVerifiedEntriesByTypes()
AddeEntries, grouped by
 AddeEntry.EntryType.Map of EntryType to a Set containing all
 of the entries that match that EntryType.public java.util.Set<java.lang.String> getGroupsFor(java.lang.String address, AddeEntry.EntryType type)
address - ADDE server address whose groups are needed.
 Cannot be null.type - Only include groups that match AddeEntry.EntryType.
 Cannot be null.java.lang.NullPointerException - if either address or type
 is null.public java.util.List<AddeEntry> searchWithPrefix(java.lang.String prefix)
prefix.prefix - String to match. Cannot be null.List containing matching entries. If there were no 
 matches the List will be empty.java.lang.NullPointerException - if prefix is null.AddeEntry.asStringId()public java.util.Set<java.lang.String> getAddresses()
Set containing all of the stored addresses. If no 
 addresses are stored, an empty Set is returned.public java.util.Set<java.lang.String> getRemoteEntryTexts()
RemoteAddeEntry.RemoteAddeEntry.getEntryText()public java.util.Set<java.lang.String> getGroups(java.lang.String address)
Set of "groups" associated with the 
 given address.address - Address of a server.address or an
 empty Set.public java.util.Set<AddeEntry.EntryType> getTypes(java.lang.String address, java.lang.String group)
address - Address of a server.group - Group whose "types" you want.address and 
 group or an empty Set if there were no matches.public AddeAccount getAccountingFor(java.lang.String address, java.lang.String group, AddeEntry.EntryType type)
Set, there cannot be duplicate entries,
 so there is no need to worry about our criteria finding multiple 
 matches.
 
 Also note that none of the given parameters accept null 
 values.
address - Address of the server.group - Dataset.type - Group type.AddeAccount for the given criteria, or 
 AddeEntry.DEFAULT_ACCOUNT if there was no match.RemoteAddeEntry.equals(Object)public AddeAccount getAccountingFor(ucar.unidata.idv.chooser.adde.AddeServer idvServer, java.lang.String typeAsStr)
idvServer and
 typeAsStr.idvServer - Server to search for.typeAsStr - One of "IMAGE", "POINT",
 "GRID", "TEXT", "NAV",
 "RADAR", "UNKNOWN", or "INVALID".AddeAccount associated with idvServer and
 typeAsStr.public java.util.Set<AddeEntry> getEntrySet()
Set of AddeEntries.public java.util.Set<AddeEntry> getPersistedEntrySet()
AddeEntries.Set of ADDE entries that stick around between McIDAS-V
 sessions.public java.util.Set<RemoteAddeEntry> getRemoteEntries()
Set of
 RemoteAddeEntries.Set of remote ADDE entries stored within the available
 entries.public java.util.Set<LocalAddeEntry> getLocalEntries()
Set of
 LocalAddeEntries.Set of local ADDE entries  stored within the available
 entries.public java.util.Set<LocalAddeEntry> getPersistedLocalEntries()
Set of LocalAddeEntries that
 will be saved between McIDAS-V sessions.
 
 Note: all this does is check LocalAddeEntry.isTemporary field.
public java.util.Set<LocalAddeEntry> getTemporaryLocalEntries()
LocalAddeEntries that will be removed
 at the end of the current McIDAS-V session.Set of all the temporary local ADDE entries.private java.util.Set<LocalAddeEntry> filterLocalEntriesByTemporaryStatus(boolean getTemporaryEntries)
getTemporaryEntries - true returns temporary local
 entries; false returns local entries that are permanent.Set of filtered local ADDE entries.public boolean removeEntries(java.util.Collection<? extends AddeEntry> removedEntries)
AddeEntries.removedEntries - AddeEntry objects to remove.
 Cannot be null.removeEntries were removed.java.lang.NullPointerException - if removedEntries is null.public boolean removeEntry(AddeEntry entry)
AddeEntry from the set of available entries.entry - Entry to remove. Cannot be null.true if something was removed, false otherwise.java.lang.NullPointerException - if entry is null.public void addEntry(AddeEntry entry)
entry - Entry to add. Cannot be null.java.lang.NullPointerException - if entry is null.public void addEntries(java.util.Collection<? extends AddeEntry> newEntries)
newEntries - New entries to add to the server manager. Cannot be
 null.java.lang.NullPointerException - if newEntries is null.public void replaceEntries(java.util.Collection<? extends AddeEntry> oldEntries, java.util.Collection<? extends AddeEntry> newEntries)
oldEntries - Entries to be replaced. Cannot be null.newEntries - Entries to use as replacements. Cannot be 
 null.java.lang.NullPointerException - if either of oldEntries or 
 newEntries is null.public java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer.Group> getIdvStyleLocalGroups()
LocalAddeEntries as a
 collection of "IDV style" AddeServer.Group
 objects.Set of AddeServer.Group objects that corresponds
 with the enabled, valid local ADDE entries.public java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer.Group> getIdvStyleRemoteGroups(java.lang.String server, java.lang.String typeAsStr)
server and
 typeAsStr parameters as a collection of
 AddeServer.Group
 objects.server - Remote ADDE server. Should not be null.typeAsStr - Entry type. One of "IMAGE",
 "POINT", "GRID", "TEXT",
 "NAV", "RADAR", "UNKNOWN", or
 "INVALID". Should not be null.Set of AddeServer.Group objects that corresponds
 to the entries associated with server and typeAsStr.public java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer.Group> getIdvStyleRemoteGroups(java.lang.String server, AddeEntry.EntryType type)
server and
 type parameters as a collection of
 AddeServer.Group
 objects.server - Remote ADDE server. Should not be null.type - Entry type. Should not be null.Set of AddeServer.Group objects that corresponds
 to the entries associated with server and type.public java.util.List<ucar.unidata.idv.chooser.adde.AddeServer> getIdvStyleEntries()
AddeServer objects.AddeServer objects for each ADDE entry.public java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer> getIdvStyleEntries(AddeEntry.EntryType type)
AddeEntry.EntryType, converted to IDV AddeServer objects.type - Only add entries with this type to the returned list.
 Cannot be null.AddeServer objects for each ADDE entry of the given type.public java.util.Set<ucar.unidata.idv.chooser.adde.AddeServer> getIdvStyleEntries(java.lang.String typeAsStr)
AddeEntry.EntryType, converted to IDV AddeServer objects.typeAsStr - Only add entries with this type to the returned list. 
 Cannot be null and must be a value that works with 
 EntryTransforms.strToEntryType(String).AddeServer objects for each ADDE entry of the given type.EntryTransforms.strToEntryType(String)private java.util.Set<AddeEntry> extractResourceEntries(AddeEntry.EntrySource source, ucar.unidata.xml.XmlResourceCollection xmlResources)
source - Origin of the XML resources.xmlResources - Actual XML resources.Set of the AddeEntrys extracted from
 xmlResources.private java.util.Set<AddeEntry> extractUserEntries(ucar.unidata.xml.XmlResourceCollection xmlResources)
xmlResources - Resource collection. Cannot be null.Set of RemoteAddeEntries
 contained within resource.public static java.lang.String getAddeRootDirectory()
The default path is determined like so:
 System.getProperty("user.dir") + File.separatorChar + "adde"
 
 
 Users can provide an arbitrary path at runtime by setting the 
 debug.localadde.rootdir system property.
String containing the path to the McIDAS-X root
 directory.PROP_DEBUG_LOCALROOTpublic static boolean isAddeDebugEnabled(boolean defValue)
debug.adde.reqs system property to
 determine whether or not the user has requested ADDE URL debugging 
 output. Output is sent to System.out.
 
 Please keep in mind that the debug.adde.reqs can not 
 force debugging for all ADDE requests. To do so will require
 updates to the VisAD ADDE library.
defValue - Value to return if debug.adde.reqs has
 not been set.debug.adde.reqs. 
 Otherwise debug.adde.reqs.AddeURL, 
PROP_DEBUG_ADDEURLpublic static boolean setAddeDebugEnabled(boolean value)
debug.adde.reqs system property so
 that debugging output can be controlled without restarting McIDAS-V.
 
 Please keep in mind that the debug.adde.reqs can not 
 force debugging for all ADDE requests. To do so will require
 updates to the VisAD ADDE library.
value - New value of debug.adde.reqs.debug.adde.reqs.AddeURL, 
PROP_DEBUG_ADDEURLpublic static void setLocalPort(java.lang.String port)
port - New port number.public static java.lang.String getLocalPort()
protected static java.lang.String nextLocalPort()
public void startLocalServer()
public void stopLocalServer()
public boolean testLocalServer()
true if the local server can access userpath,
 false otherwise.public boolean checkLocalServer()
true if the local server thread is running;
 false otherwise.