org.elkoserver.foundation.server.metadata
Class HostDesc

java.lang.Object
  extended by org.elkoserver.foundation.server.metadata.HostDesc

public class HostDesc
extends Object

Contact information for establishing a network connection to a host.


Constructor Summary
HostDesc(String protocol, boolean isSecure, String hostPort, AuthDesc auth, int retryInterval, boolean dontLog)
          Constructor.
HostDesc(String protocol, String hostPort)
          Constructor, taking most defaults.
 
Method Summary
 AuthDesc auth()
          Get this host's authorization information.
 boolean dontLog()
          Test if this host descriptor says not to log traffic.
static HostDesc fromProperties(BootProperties props, String propRoot)
          Create a HostDesc object from specifications provided by properties:
 String hostPort()
          Get this host's contact address.
 String protocol()
          Get this host's protocol.
 int retryInterval()
          Get this host's retry interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostDesc

public HostDesc(String protocol,
                boolean isSecure,
                String hostPort,
                AuthDesc auth,
                int retryInterval,
                boolean dontLog)
Constructor.

Parameters:
protocol - Protocol spoken.
isSecure - Flag that is true if protocol is secure.
hostPort - Host/port/path to address for service.
auth - Authorization.
retryInterval - Connection retry interval, in seconds, or -1 to accept the default (currently 15).
dontLog - Flag not to log traffic when communicating to host.

HostDesc

public HostDesc(String protocol,
                String hostPort)
Constructor, taking most defaults.

Equivalent to new HostDesc(protocol, false, hostPort, null, -1, false)

Parameters:
protocol - Protocol spoken.
hostPort - Host/port/path to address for service.
Method Detail

dontLog

public boolean dontLog()
Test if this host descriptor says not to log traffic.

Returns:
true if this host's "don't log" flag is set.

fromProperties

public static HostDesc fromProperties(BootProperties props,
                                      String propRoot)
Create a HostDesc object from specifications provided by properties:

"propRoot.host" should contain a host:port string.
"propRoot.protocol", if given, should specify a protocol name. If not given, the protocol defaults to "tcp".
"propRoot.dontlog", a boolean, if given and true, indicates that message traffic on a connection to this host should not be logged.
"propRoot.retry", an integer, if given, is the retry interval, in seconds.

Parameters:
props - Properties to examine for a host description.
propRoot - Root property name.
Returns:
a new HostDesc object as specfied by 'props', or null if no such host was described.

auth

public AuthDesc auth()
Get this host's authorization information.

Returns:
this host's authorization information, or null if there isn't any (equivalent to open access).

hostPort

public String hostPort()
Get this host's contact address.

Returns:
this host's contact address.

protocol

public String protocol()
Get this host's protocol.

Returns:
this host's protocol.

retryInterval

public int retryInterval()
Get this host's retry interval.

Returns:
this host's retry interval, in seconds.