org.javagroups.protocols
Class JMS.JMSAddress

java.lang.Object
  |
  +--org.javagroups.protocols.JMS.JMSAddress
All Implemented Interfaces:
Address, java.lang.Cloneable, java.lang.Comparable, java.io.Externalizable, java.io.Serializable
Enclosing class:
JMS

protected static class JMS.JMSAddress
extends java.lang.Object
implements Address

Simple Address representing the JMS node ID or JMS topic group.

See Also:
Serialized Form

Fields inherited from interface org.javagroups.Address
GROUP
 
Constructor Summary
JMS.JMSAddress()
          Empty constructor to allow externalization work.
JMS.JMSAddress(java.lang.String str)
          Reconstruct the address from the string representation.
JMS.JMSAddress(java.lang.String address, boolean isMCast)
          Create instance of this class for given address string.
 
Method Summary
protected  java.lang.Object clone()
          Clone the object.
 int compareTo(java.lang.Object o)
          Compare this object to o.
 boolean equals(java.lang.Object obj)
          Test is this object is equal to obj.
 java.lang.String getAddress()
          Get the node address.
 int hashCode()
          Get the hash code of this address.
 boolean isMulticastAddress()
          Is the address a multicast address?
 void readExternal(java.io.ObjectInput in)
          Read object from external input.
 void setAddress(java.lang.String address)
          Set the node address.
 java.lang.String toString()
          Get the string representation of the address.
 void writeExternal(java.io.ObjectOutput out)
          Write the object to external output.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JMS.JMSAddress

public JMS.JMSAddress(java.lang.String address,
                      boolean isMCast)
Create instance of this class for given address string. Current implementation uses a hash mark '#' to determine if the address is a unicast or multicast. Therefore, this character is considered as reserved and is not allowed in the address parameter passed to the #JMSAddress(String, boolean) constructor.
Parameters:
address - string representing the address of the node connected to the JMS topic, usually, a value of connection.getClientID(), where the connection is instance of javax.jms.TopicConnection.
isMCast - true if the address is multicast address, otherwise - false.

JMS.JMSAddress

public JMS.JMSAddress()
Empty constructor to allow externalization work.

JMS.JMSAddress

public JMS.JMSAddress(java.lang.String str)
Reconstruct the address from the string representation. If the str starts with '#', address is considered as unicast, and node address is the substring after '#'. Otherwise, address is multicast and address is str itself.
Parameters:
str - string used to reconstruct the instance.
Method Detail

getAddress

public java.lang.String getAddress()
Get the node address.
Returns:
node address in the form passed to the constructor #JMSAddress(String, boolean).

setAddress

public void setAddress(java.lang.String address)
Set the node address.
Parameters:
address - new node address.

isMulticastAddress

public boolean isMulticastAddress()
Is the address a multicast address?
Specified by:
isMulticastAddress in interface Address
Returns:
true if the address is multicast address.

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Clone the object.
Overrides:
clone in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compare this object to o. It is possible to compare only addresses of the same class. Also they both should be either multicast or unicast addresses.
Specified by:
compareTo in interface java.lang.Comparable
Returns:
value compliant with the Comparable.compareTo(Object) specififaction.

equals

public boolean equals(java.lang.Object obj)
Test is this object is equal to obj.
Overrides:
equals in class java.lang.Object
Returns:
true iff the obj is JMSAddress, node addresses are equal and they both are either multicast or unicast addresses.

hashCode

public int hashCode()
Get the hash code of this address.
Overrides:
hashCode in class java.lang.Object
Returns:
hash code of this object.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Read object from external input.
Specified by:
readExternal in interface java.io.Externalizable

toString

public java.lang.String toString()
Get the string representation of the address. The following property holds: a2.equals(a1) is always true, where a2 is JMSAddress a2 = new JMSAddress(a1.toString());
Overrides:
toString in class java.lang.Object
Returns:
string representation of the address.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Write the object to external output.
Specified by:
writeExternal in interface java.io.Externalizable


Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.