org.otfeed
Class OTConnectionSpec

java.lang.Object
  extended by org.otfeed.OTConnectionSpec
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
OtfeedActivationSpec, OtfeedConnectionRequestInfo

public class OTConnectionSpec
extends java.lang.Object
implements java.io.Serializable

Connection Specification. Encapsulates parameters of a connection to the Opentick server. This includes username/password, connection addresses, et al. This object has value semantics, i.e. it compares to true iff all its properties compare to true. Note that it does deep copy of Hosts and re-orders them according to the natural order. Therefore, order in which host set was populated does not matter for comparison purposes.

See Also:
Serialized Form

Field Summary
static long DEFAULT_HEARTBEAT_INTERVAL
           
 
Constructor Summary
OTConnectionSpec()
          Creates empty connection specification.
OTConnectionSpec(OTConnectionSpec other)
          Creates connection specification by cloning the model one.
 
Method Summary
 boolean equals(java.lang.Object obj)
          
 java.lang.Long getHeartbeatInterval()
          Heartbeat interval in millis.
 java.util.Set<OTHost> getHosts()
          Set of hosts to connect.
 java.lang.String getHostsString()
          Provides convenient access to getHosts() property: allows user to set/get it as a string value - a comma-separated list of host addresses.
 java.lang.String getPassword()
          Password for accessing Opentick datat.
 java.lang.String getUsername()
          Username for accessing Opentick data.
 int hashCode()
          
 void setHeartbeatInterval(java.lang.Long heartbeatInterval)
          Sets the heartbeat interval (in millis).
 void setHosts(java.util.Set<OTHost> val)
          Sets hosts to connect.
 void setHostsString(java.lang.String val)
          Sets setHosts(java.util.Set) property by parsing comma-separated list of host addresses.
 void setPassword(java.lang.String password)
          Sets the password of the Opentick account.
 void setUsername(java.lang.String username)
          Sets the user name of the Opentick account.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_HEARTBEAT_INTERVAL

public static final long DEFAULT_HEARTBEAT_INTERVAL
See Also:
Constant Field Values
Constructor Detail

OTConnectionSpec

public OTConnectionSpec()
Creates empty connection specification.


OTConnectionSpec

public OTConnectionSpec(OTConnectionSpec other)
Creates connection specification by cloning the model one.

Parameters:
other - model specs.
Method Detail

getUsername

public java.lang.String getUsername()
Username for accessing Opentick data.

Returns:
username.

setUsername

public void setUsername(java.lang.String username)
Sets the user name of the Opentick account.

Parameters:
username - name

getPassword

public java.lang.String getPassword()
Password for accessing Opentick datat.

Returns:
password

setPassword

public void setPassword(java.lang.String password)
Sets the password of the Opentick account.

Parameters:
password -

getHosts

public java.util.Set<OTHost> getHosts()
Set of hosts to connect.

Returns:
hosts.

setHosts

public void setHosts(java.util.Set<OTHost> val)
Sets hosts to connect. Does deep copy.

Parameters:
val -

getHostsString

public java.lang.String getHostsString()
Provides convenient access to getHosts() property: allows user to set/get it as a string value - a comma-separated list of host addresses.

For example:

    spec.setHostsString("feed1.opentick.com:10015,feed2.opentick.com:10010");
 

Returns:
string representation of hosts property.

setHostsString

public void setHostsString(java.lang.String val)
                    throws java.lang.IllegalArgumentException
Sets setHosts(java.util.Set) property by parsing comma-separated list of host addresses.

Parameters:
val - value to parse.
Throws:
java.lang.IllegalArgumentException - if can not parse spring.

getHeartbeatInterval

public java.lang.Long getHeartbeatInterval()
Heartbeat interval in millis.

Returns:
heartbeat interval value.

setHeartbeatInterval

public void setHeartbeatInterval(java.lang.Long heartbeatInterval)
Sets the heartbeat interval (in millis). Default is 10000, which is 10 seconds.

Parameters:
heartbeatInterval - new heartbeat interval.

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2007-2008 Mike Kroutikov. All Rights Reserved.