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 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) |
static Map<AddeEntry.EntryType,RemoteEntryEditor.AddeStatus> |
checkEntryTypes(String host,
String group,
String user,
String proj) |
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() |
int |
hashCode()
Returns a hash code for this ADDE entry.
|
static Set<String> |
readGroups(String host,
String user,
String proj) |
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) |
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 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
LocalAddeEntry
s will return localhost
.getAddress
in interface AddeEntry
address
public String getGroup()
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 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
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)
RemoteAddeEntry
represents a valid remote ADDE server. If not,
the method tries to determine which parts of the entry are invalid.
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)
RemoteAddeEntry
represents a valid remote ADDE server. If not,
the method tries to determine which parts of the entry are invalid.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)
public static Map<AddeEntry.EntryType,RemoteEntryEditor.AddeStatus> checkEntryTypes(String host, String group, String user, String proj)
public static Set<String> readPublicGroups(String host)