|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.wisc.ssec.mcidasv.servermanager.EntryStore
public class EntryStore
| Nested Class Summary | |
|---|---|
static class |
EntryStore.Event
Enumeration of the various server manager events. |
| Field Summary | |
|---|---|
private String |
ADDE_BIN
Path to local server binaries. |
private String |
ADDE_DATA
Path to local server data. |
private String |
ADDE_DIRECTORY
"Root" local server directory. |
private String |
ADDE_MCSERVL
Path to mcservl. |
private String |
ADDE_RESOLV
Path to the user's "RESOLV.SRV". |
private IdvObjectStore |
idvStore
|
private List<AddeEntry> |
lastAdded
The last AddeEntrys added to the manager. |
private static String |
localPort
Which port is this particular manager operating on |
private static org.slf4j.Logger |
logger
Logging object. |
private String |
MCTRACE
|
private static String |
PREF_ADDE_ENTRIES
|
private static String |
PROP_DEBUG_ADDEURL
Property that allows users to control debug output from ADDE requests. |
private static String |
PROP_DEBUG_LOCALROOT
Property that allows users to supply arbitrary paths to McIDAS-X binaries used by mcservl. |
private boolean |
restartingMcserv
|
private static AddeThread |
thread
Thread that monitors the mcservl process. |
private PatriciaTrie<String,AddeEntry> |
trie
The ADDE servers known to McIDAS-V. |
private String |
USER_DIRECTORY
Path to the user's "userpath" directory. |
| Constructor Summary | |
|---|---|
EntryStore(IdvObjectStore store,
IdvResourceManager rscManager)
Constructs a server manager. |
|
| Method Summary | |
|---|---|
void |
addEntries(Collection<? extends AddeEntry> newEntries)
Adds a Set of AddeEntrys to trie. |
boolean |
checkLocalServer()
Check to see if the thread is running. |
private Set<AddeEntry> |
extractFromPreferences(IdvObjectStore store)
Returns the AddeEntrys stored
in the user's preferences. |
private Set<AddeEntry> |
extractResourceEntries(AddeEntry.EntrySource source,
XmlResourceCollection xmlResources)
Process all of the "IDV-style" XML resources for a given "source". |
private Set<AddeEntry> |
extractUserEntries(XmlResourceCollection xmlResources)
Process all of the "user" XML resources. |
AddeAccount |
getAccountingFor(AddeServer idvServer,
String typeAsStr)
|
AddeAccount |
getAccountingFor(String address,
String group,
AddeEntry.EntryType type)
Searches the set of servers in an attempt to locate the accounting information for the matching server. |
protected String[] |
getAddeCommands()
|
static String |
getAddeRootDirectory()
Returns the path to where the root directory of the user's McIDAS-X binaries should be. |
Set<String> |
getAddresses()
Returns the Set of AddeEntry addresses stored
in this EntryStore. |
Set<AddeEntry> |
getEntrySet()
Returns the complete Set of AddeEntrys. |
Set<String> |
getGroups(String address)
Returns the Set of "groups" associated with the
given address. |
Set<String> |
getGroupsFor(String address,
AddeEntry.EntryType type)
Returns the Set of AddeEntry.getGroup()s
that match the given address and type. |
IdvObjectStore |
getIdvStore()
|
List<AddeServer> |
getIdvStyleEntries()
Returns a list of all available ADDE datasets, converted to IDV AddeServer objects. |
Set<AddeServer> |
getIdvStyleEntries(AddeEntry.EntryType type)
Returns a list that consists of the available ADDE datasets for a given AddeEntry.EntryType, converted to IDV AddeServer objects. |
Set<AddeServer> |
getIdvStyleEntries(String typeAsStr)
Returns a list that consists of the available ADDE datasets for a given AddeEntry.EntryType, converted to IDV AddeServer objects. |
Set<AddeServer.Group> |
getIdvStyleLocalGroups()
|
Set<AddeServer.Group> |
getIdvStyleRemoteGroups(String server,
AddeEntry.EntryType type)
|
Set<AddeServer.Group> |
getIdvStyleRemoteGroups(String server,
String typeAsStr)
|
List<AddeEntry> |
getLastAdded()
|
List<AddeEntry> |
getLastAddedByType(AddeEntry.EntryType type)
Searches the newest entries for the entries of the given EntryType. |
List<AddeEntry> |
getLastAddedByTypes(EnumSet<AddeEntry.EntryType> types)
|
Set<LocalAddeEntry> |
getLocalEntries()
Returns the complete Set of LocalAddeEntrys. |
static String |
getLocalPort()
Ask for the port we are listening on. |
Set<RemoteAddeEntry> |
getRemoteEntries()
Returns the complete Set of RemoteAddeEntrys. |
Set<String> |
getRemoteEntryTexts()
Returns a Set containing ADDRESS/GROUPNAME Strings
for each RemoteAddeEntry. |
Set<AddeEntry.EntryType> |
getTypes(String address,
String group)
Returns the Set of AddeEntry.EntryTypes for a given group
on a given address. |
protected String[] |
getUnixAddeEnv()
|
Set<AddeEntry> |
getVerifiedEntries(AddeEntry.EntryType type)
Returns the Set of AddeEntrys that are known to work (for
a given AddeEntry.EntryType of entries). |
Map<AddeEntry.EntryType,Set<AddeEntry>> |
getVerifiedEntriesByTypes()
|
protected String[] |
getWindowsAddeEnv()
|
static boolean |
isAddeDebugEnabled(boolean defaultValue)
Checks the value of the debug.adde.reqs system 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 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<String,AddeEntry> trie,
Collection<? extends AddeEntry> newEntries)
|
boolean |
removeEntries(Collection<? extends AddeEntry> removedEntries)
|
boolean |
removeEntry(AddeEntry entry)
Removes a single AddeEntry from the set of available entries. |
void |
replaceEntries(Collection<? extends AddeEntry> oldEntries,
Collection<? extends AddeEntry> newEntries)
Replaces the AddeEntrys within trie with the contents
of newEntries. |
void |
saveEntries()
Saves the current set of ADDE servers to the user's preferences. |
List<AddeEntry> |
searchWithPrefix(String prefix)
Search the server manager for entries that match prefix. |
static boolean |
setAddeDebugEnabled(boolean value)
Sets the value of the debug.adde.reqs system property so
that debugging output can be controlled without restarting McIDAS-V. |
static void |
setLocalPort(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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final String PROP_DEBUG_LOCALROOT
getAddeRootDirectory(),
Constant Field Valuesprivate static final String PROP_DEBUG_ADDEURL
isAddeDebugEnabled(boolean),
setAddeDebugEnabled(boolean),
Constant Field Valuesprivate static final org.slf4j.Logger logger
private static final String PREF_ADDE_ENTRIES
private final PatriciaTrie<String,AddeEntry> trie
private final String ADDE_DIRECTORY
private final String ADDE_BIN
private final String ADDE_DATA
private final String ADDE_MCSERVL
private final String USER_DIRECTORY
private final String ADDE_RESOLV
private final String MCTRACE
private static String localPort
private static AddeThread thread
private final List<AddeEntry> lastAdded
AddeEntrys added to the manager.
private final IdvObjectStore idvStore
private boolean restartingMcserv
| Constructor Detail |
|---|
public EntryStore(IdvObjectStore store,
IdvResourceManager rscManager)
store - rscManager - | Method Detail |
|---|
private static void putEntries(PatriciaTrie<String,AddeEntry> trie,
Collection<? extends AddeEntry> newEntries)
trie - Cannot be null.newEntries - Cannot be null.public IdvObjectStore getIdvStore()
protected String[] getWindowsAddeEnv()
protected String[] getUnixAddeEnv()
protected String[] getAddeCommands()
public static boolean isInvalidEntry(AddeEntry entry)
AddeEntry.
entry - Entry to check. Cannot be null.
true if entry is invalid or false otherwise.
AssertionError - if entry is somehow neither a RemoteAddeEntry or LocalAddeEntry.LocalAddeEntry.INVALID_ENTRY,
RemoteAddeEntry.INVALID_ENTRYprivate Set<AddeEntry> extractFromPreferences(IdvObjectStore store)
AddeEntrys 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.public void saveEntries()
public List<AddeEntry> getLastAddedByType(AddeEntry.EntryType type)
EntryType.
type - Look for entries matching this EntryType. Cannot be null.
List of entries or an empty List.
NullPointerException - if type is null.public List<AddeEntry> getLastAddedByTypes(EnumSet<AddeEntry.EntryType> types)
public List<AddeEntry> getLastAdded()
public Set<AddeEntry> getVerifiedEntries(AddeEntry.EntryType type)
Set of AddeEntrys that are known to work (for
a given AddeEntry.EntryType of entries).
type - The EntryType you are interested in.
Set of matching RemoteAddeEntrys. If there
were no matches, an empty Set is returned.public Map<AddeEntry.EntryType,Set<AddeEntry>> getVerifiedEntriesByTypes()
public Set<String> getGroupsFor(String address,
AddeEntry.EntryType type)
Set of AddeEntry.getGroup()s
that match the given address and type.
address - ADDE server address whose groups are needed.
Cannot be null.type - Only include groups that match AddeEntry.EntryType.
Cannot be null.
public List<AddeEntry> searchWithPrefix(String prefix)
prefix.
prefix - String to match.
List containing matching entries. If there were no
matches the List will be empty.AddeEntry.asStringId()public Set<String> getAddresses()
Set of AddeEntry addresses stored
in this EntryStore.
Set containing all of the stored addresses. If no
addresses are stored, an empty Set is returned.public Set<String> getRemoteEntryTexts()
Set containing ADDRESS/GROUPNAME Strings
for each RemoteAddeEntry.
RemoteAddeEntry.RemoteAddeEntry.getEntryText()public Set<String> getGroups(String address)
Set of "groups" associated with the
given address.
address - Address of a server.
address or an
empty Set.
public Set<AddeEntry.EntryType> getTypes(String address,
String group)
Set of AddeEntry.EntryTypes for a given group
on a given address.
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(String address,
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(AddeServer idvServer,
String typeAsStr)
public Set<AddeEntry> getEntrySet()
Set of AddeEntrys.
public Set<RemoteAddeEntry> getRemoteEntries()
Set of RemoteAddeEntrys.
RemoteAddeEntrys stored within the available entries.public Set<LocalAddeEntry> getLocalEntries()
Set of LocalAddeEntrys.
LocalAddeEntrys stored within the available entries.public boolean removeEntries(Collection<? extends AddeEntry> removedEntries)
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.public void addEntries(Collection<? extends AddeEntry> newEntries)
Set of AddeEntrys to trie.
newEntries - New entries to add to the server manager. Cannot be
null.
NullPointerException - if newEntries is null.
public void replaceEntries(Collection<? extends AddeEntry> oldEntries,
Collection<? extends AddeEntry> newEntries)
AddeEntrys within trie with the contents
of newEntries.
oldEntries - Entries to be replaced. Cannot be null.newEntries - Entries to use as replacements. Cannot be
null.
NullPointerException - if either of oldEntries or
newEntries is null.public Set<AddeServer.Group> getIdvStyleLocalGroups()
public Set<AddeServer.Group> getIdvStyleRemoteGroups(String server,
String typeAsStr)
public Set<AddeServer.Group> getIdvStyleRemoteGroups(String server,
AddeEntry.EntryType type)
public List<AddeServer> getIdvStyleEntries()
AddeServer objects.
AddeServer objects for each ADDE entry.public Set<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 Set<AddeServer> getIdvStyleEntries(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 Set<AddeEntry> extractResourceEntries(AddeEntry.EntrySource source,
XmlResourceCollection xmlResources)
source - Origin of the XML resources.xmlResources - Actual XML resources.
Set of the AddeEntrys extracted from
xmlResources.private Set<AddeEntry> extractUserEntries(XmlResourceCollection xmlResources)
xmlResources - Resource collection. Cannot be null.
Set of RemoteAddeEntrys contained within
resource.public static 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 defaultValue)
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.
defaultValue - 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(String port)
port - New port number.public static String getLocalPort()
protected static String nextLocalPort()
public void startLocalServer()
public void stopLocalServer()
public boolean checkLocalServer()
true if the local server thread is running; false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||