public class RemoteAddeEntry extends Object implements AddeEntry
Modifier and Type | Class and Description |
---|---|
static class |
RemoteAddeEntry.Builder
Something of a hack... this approach allows us to build a
RemoteAddeEntry in a readable way, despite there being
multiple final fields. |
AddeEntry.EditorAction, AddeEntry.EntrySource, AddeEntry.EntryStatus, AddeEntry.EntryType, AddeEntry.EntryValidity
Modifier and Type | Field and Description |
---|---|
private AddeAccount |
account
Holds the accounting information for this entry.
|
static int |
ADDE_PORT
Default port for remote ADDE servers.
|
private String |
address
The server "address" of this entry.
|
private String |
asStringId |
private String |
entryAlias
Allows the user to refer to this entry with an arbitrary name.
|
private AddeEntry.EntrySource |
entrySource
Where this entry came from.
|
private AddeEntry.EntryStatus |
entryStatus
Whether or not this entry is in the "active set".
|
private AddeEntry.EntryType |
entryType
This entry's type.
|
private AddeEntry.EntryValidity |
entryValidity
Whether or not this entry is valid.
|
private String |
group
The "dataset" of this entry.
|
private int |
hashCode
Used so that the hashCode of this entry is not needlessly
recalculated.
|
static List<RemoteAddeEntry> |
INVALID_ENTRIES
Represents a collection of invalid remote ADDE entries.
|
static RemoteAddeEntry |
INVALID_ENTRY
Represents an invalid remote ADDE entry.
|
private boolean |
isTemporary
Whether or not this entry will persist between McIDAS-V sessions.
|
private static org.slf4j.Logger |
logger
Typical logger object.
|
private static String |
publicSrvFormat
|
DEFAULT_ACCOUNT
Modifier | Constructor and Description |
---|---|
private |
RemoteAddeEntry(RemoteAddeEntry.Builder builder)
Creates a new ADDE entry using a give "ADDE entry builder".
|
Modifier and Type | Method and Description |
---|---|
String |
asStringId()
Currently used as a identifier for convenient storage by the server
manager.
|
static RemoteEntryEditor.AddeStatus |
checkEntry(boolean checkHost,
RemoteAddeEntry entry)
Attempts to verify whether or not the information in a given
RemoteAddeEntry represents a valid remote ADDE server.
|
static RemoteEntryEditor.AddeStatus |
checkEntry(RemoteAddeEntry entry)
Attempts to verify whether or not the information in a given
RemoteAddeEntry represents a valid remote ADDE server.
|
static Map<AddeEntry.EntryType,RemoteEntryEditor.AddeStatus> |
checkEntryTypes(String host,
String group)
Determine the types of ADDE data within the given
group on
host . |
static Map<AddeEntry.EntryType,RemoteEntryEditor.AddeStatus> |
checkEntryTypes(String host,
String group,
String user,
String proj)
Determine the types of ADDE data within the given
group on
host . |
static boolean |
checkHost(RemoteAddeEntry entry)
Determines whether or not the server specified in
entry is
listening on port 112. |
boolean |
equals(Object obj)
Determines whether or not the given object is equivalent to this ADDE
entry.
|
AddeAccount |
getAccount()
Accounting information associated with the current entry.
|
String |
getAddress()
Address of the server associated with the current entry.
|
String |
getEntryAlias() |
AddeEntry.EntrySource |
getEntrySource()
Source that specified this entry.
|
AddeEntry.EntryStatus |
getEntryStatus()
GUI status of the entry.
|
String |
getEntryText()
Handy
String representation of this ADDE entry. |
AddeEntry.EntryType |
getEntryType()
Type of chooser this entry should appear under.
|
AddeEntry.EntryValidity |
getEntryValidity()
Does this entry represent a "valid" ADDE server.
|
String |
getGroup()
Dataset/group located on the server.
|
String |
getName()
Name associated with this entry.
|
int |
hashCode()
Returns a hash code for this ADDE entry.
|
boolean |
isEntryTemporary()
Determine whether or not this entry will be saved between application
sessions.
|
static Set<String> |
readGroups(String host,
String user,
String proj)
Attempts to determine which (if any) ADDE groups are available on the
given
host . |
static Set<String> |
readPublicGroups(RemoteAddeEntry entry)
Tries to connect to a given
RemoteAddeEntry and read the list
of ADDE "groups" available to the public. |
static Set<String> |
readPublicGroups(String host)
Attempts to determine the "public" ADDE groups available on
the given
host . |
void |
setEntryAlias(String newAlias) |
void |
setEntryStatus(AddeEntry.EntryStatus newStatus) |
void |
setEntryValidity(AddeEntry.EntryValidity entryValidity) |
String |
toString()
String representation of this entry.
|
private static final org.slf4j.Logger logger
public static final RemoteAddeEntry INVALID_ENTRY
public static final List<RemoteAddeEntry> INVALID_ENTRIES
public static final int ADDE_PORT
private static final String publicSrvFormat
String.format(String, Object...)
-friendly string for building a
request to read a server's "PUBLIC.SRV".private final AddeAccount account
private final boolean isTemporary
private AddeEntry.EntryType entryType
private AddeEntry.EntryValidity entryValidity
private AddeEntry.EntrySource entrySource
private AddeEntry.EntryStatus entryStatus
private String entryAlias
private String asStringId
private volatile int hashCode
hashCode()
private RemoteAddeEntry(RemoteAddeEntry.Builder builder)
builder
- Object used to build this entry.public String getAddress()
AddeEntry
LocalAddeEntries
will return localhost
.getAddress
in interface AddeEntry
address
public String getGroup()
AddeEntry
public String getName()
AddeEntry
public AddeAccount getAccount()
AddeEntry
AddeEntry.DEFAULT_ACCOUNT
.getAccount
in interface AddeEntry
account
public AddeEntry.EntryType getEntryType()
AddeEntry
getEntryType
in interface AddeEntry
entryType
public AddeEntry.EntryValidity getEntryValidity()
AddeEntry
getEntryValidity
in interface AddeEntry
entryValidity
public void setEntryValidity(AddeEntry.EntryValidity entryValidity)
public AddeEntry.EntrySource getEntrySource()
AddeEntry
getEntrySource
in interface AddeEntry
entrySource
public AddeEntry.EntryStatus getEntryStatus()
AddeEntry
AddeEntry.EntryValidity
in that
EntryStatus
controls this entry showing up in a chooser and has
nothing to do with whether or not the entry is a valid ADDE server.getEntryStatus
in interface AddeEntry
entryStatus
public void setEntryStatus(AddeEntry.EntryStatus newStatus)
setEntryStatus
in interface AddeEntry
public String getEntryAlias()
getEntryAlias
in interface AddeEntry
public void setEntryAlias(String newAlias)
setEntryAlias
in interface AddeEntry
public boolean isEntryTemporary()
AddeEntry
isEntryTemporary
in interface AddeEntry
public String getEntryText()
String
representation of this ADDE entry. Currently looks
like ADDRESS/GROUP
, but this is subject to change.getEntryText
in interface AddeEntry
String
representation of this entry.public boolean equals(Object obj)
public int hashCode()
public String asStringId()
AddeEntry
asStringId
in interface AddeEntry
public String toString()
AddeEntry
Output will typically contain internal details and as such will differ
from AddeEntry.getEntryText()
.
public static Set<String> readPublicGroups(RemoteAddeEntry entry)
RemoteAddeEntry
and read the list
of ADDE "groups" available to the public.entry
- The RemoteAddeEntry
to query. Cannot be null
.Set
of public groups on entry
.NullPointerException
- if entry
is null
.IllegalArgumentException
- if the server address is an empty
String
.public static boolean checkHost(RemoteAddeEntry entry)
entry
is
listening on port 112.entry
- Descriptor containing the server to check.true
if a connection was opened, false
otherwise.NullPointerException
- if entry
is null.public static RemoteEntryEditor.AddeStatus checkEntry(RemoteAddeEntry entry)
Note that this method uses checkHost(RemoteAddeEntry)
to
verify that the server is listening. To forego the check, simply call
checkEntry(false, entry)
.
entry
- RemoteAddeEntry
to check. Cannot be
null
.RemoteEntryEditor.AddeStatus
that represents the verification status
of entry
.checkHost(RemoteAddeEntry)
,
checkEntry(boolean, RemoteAddeEntry)
public static RemoteEntryEditor.AddeStatus checkEntry(boolean checkHost, RemoteAddeEntry entry)
checkHost
- true
tries to connect to the remote ADDE server
before doing anything else.entry
- RemoteAddeEntry
to check. Cannot be
null
.RemoteEntryEditor.AddeStatus
that represents the verification status
of entry
.NullPointerException
- if entry
is null
.RemoteEntryEditor.AddeStatus
public static Map<AddeEntry.EntryType,RemoteEntryEditor.AddeStatus> checkEntryTypes(String host, String group)
group
on
host
. This method uses the "default" ADDE user name
and project number.
Note: parameters cannot be null
.
host
- Host to check.group
- ADDE group.EnumMap
that maps ADDE data type to whether or not it
is available for the given host
and group
.public static Map<AddeEntry.EntryType,RemoteEntryEditor.AddeStatus> checkEntryTypes(String host, String group, String user, String proj)
group
on
host
.
Note: parameters cannot be null
.
host
- Host to check.group
- ADDE group.user
- ADDE user name.proj
- ADDE project number.EnumMap
that maps ADDE data type to whether or not it
is available for the given set of parameters.checkEntry(boolean, RemoteAddeEntry)
public static Set<String> readPublicGroups(String host)
host
.
Note: this method uses the "default" ADDE user name and project number.
host
- Host from which public groups are to be read. Cannot be null
.Set
of the public groups on host
. The
Set
will be empty if there are no groups.public static Set<String> readGroups(String host, String user, String proj)
host
.
Note: parameters cannot be null
.
host
- Host from which public groups are to be read.user
- ADDE user name.proj
- ADDE project number.Set
of the groups on host
. The Set
will
be empty if there are no groups.