dk.netarkivet.common.distribute
Class ChannelID

java.lang.Object
  extended by dk.netarkivet.common.distribute.ChannelID
All Implemented Interfaces:
java.io.Serializable

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

A class for representing the names of JMS queues.

See Also:
Serialized Form

Field Summary
(package private) static java.lang.String COMMON
          Constants to make the semantics of parameters to our name constructors more explicit.
(package private) static boolean INCLUDE_APPLINST_ID
           
(package private) static boolean INCLUDE_IP
           
(package private) static boolean NO_APPLINST_ID
           
(package private) static boolean NO_IP
           
(package private) static boolean QUEUE
           
(package private) static boolean TOPIC
           
 
Constructor Summary
ChannelID(java.lang.String appPref, java.lang.String replicaId, boolean useNodeId, boolean useAppInstId, boolean isTopic)
          Constructor of channel names.
 
Method Summary
 boolean equals(java.lang.Object o)
          Implements equality check for ChannelIDs.
 java.lang.String getName()
          Getter for the channel name.
 int hashCode()
          Computes a hash code based on the channel name and whether it is a topic.
 java.lang.String toString()
          Pretty-printer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMON

static final java.lang.String COMMON
Constants to make the semantics of parameters to our name constructors more explicit.

See Also:
Constant Field Values

INCLUDE_IP

static final boolean INCLUDE_IP
See Also:
Constant Field Values

NO_IP

static final boolean NO_IP
See Also:
Constant Field Values

INCLUDE_APPLINST_ID

static final boolean INCLUDE_APPLINST_ID
See Also:
Constant Field Values

NO_APPLINST_ID

static final boolean NO_APPLINST_ID
See Also:
Constant Field Values

TOPIC

static final boolean TOPIC
See Also:
Constant Field Values

QUEUE

static final boolean QUEUE
See Also:
Constant Field Values
Constructor Detail

ChannelID

ChannelID(java.lang.String appPref,
          java.lang.String replicaId,
          boolean useNodeId,
          boolean useAppInstId,
          boolean isTopic)
Constructor of channel names. The constructor is package private because we should never use any channels except the ones constructed by our friend Channels.java

Parameters:
appPref - The prefix used for the applications listening to the channel.
replicaId - Name of the replica, or ChannelID.COMMON if channel shared by all replicas.
useNodeId - Whether that IP address of the local node should be included in the channel name.
useAppInstId - Whether application instance id from settings should be included in the channel name.
isTopic - Whether the Channel is a Topic or a Queue.
Throws:
UnknownID - if looking up the local IP number failed.
Method Detail

getName

public java.lang.String getName()
Getter for the channel name.

Returns:
The name of the channel referred to by this object.

toString

public java.lang.String toString()
Pretty-printer.

Overrides:
toString in class java.lang.Object
Returns:
a nice String representation of the ChannelID.

equals

public boolean equals(java.lang.Object o)
Implements equality check for ChannelIDs. Useful when these are used as indexes in Java collections, for instance.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object to compare this object with.
Returns:
Whether o and this should be considered the same ChannelID.

hashCode

public int hashCode()
Computes a hash code based on the channel name and whether it is a topic.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code for this object.