dk.netarkivet.common.distribute
Class Channels

java.lang.Object
  extended by dk.netarkivet.common.distribute.Channels

public class Channels
extends java.lang.Object

This singleton class is in charge of giving out the correct channels.


Field Summary
static java.lang.String CHANNEL_PART_SEPARATOR
          Channel part separator.
 
Method Summary
static ChannelID[] getAllArchives_ALL_BAs()
          Returns ALL_BA channels for every known bitarchive.
static ChannelID[] getAllArchives_ANY_BAs()
          Returns ANY_BA channels for every known bitarchive.
static ChannelID[] getAllArchives_BAMONs()
          Returns BAMON channels for every known bitarchive (replica).
static ChannelID[] getAllArchives_CRs()
          Returns the channels for the all Checksum replicas.
static ChannelID getAllBa()
          Returns the topic that all bitarchive machines on this replica are listening on.
static ChannelID getAnyBa()
          Returns the channel where exactly one of all the bitarchive machines at this replica will get the message.
static ChannelID getAnyHighpriorityHaco()
          Returns the queue which is used by the scheduler to send doOneCrawl to Harvest Controllers of high priority (selective harvests).
static ChannelID getAnyLowpriorityHaco()
          Returns the queue which is used by the scheduler to send doOneCrawl to Harvest Controllers of low priority (snapshot harvests).
static ChannelID getBaMonForReplica(java.lang.String replicaId)
          Given an replica, returns the BAMON queue to which batch jobs must be sent in order to run them on that bitarchive.
static ChannelID getError()
          Returns the queue on which to put errors which are not handled elsewhere.
static ChannelID getHarvestDispatcherChannel()
          Return the queue for the harvest dispatcher.
static ChannelID getHarvestMonitorChannel()
          Return the queue for the harvest monitor registry.
static java.util.Collection<Replica> getReplicas()
          Method for retrieving the list of replicas used for the channels.
static ChannelID getTheBamon()
          Returns the queue for sending messages to bitarchive monitors.
static ChannelID getTheCR()
          Method for retrieving the 'THE_CR' channel for this replica.
static ChannelID getTheCrForReplica(java.lang.String replicaId)
           
static ChannelID getTheIndexServer()
          Returns the queue for sending messages to the IndexServer application.
static ChannelID getTheMonitorServer()
          Return the queue for the monitor registry.
static ChannelID getTheRepos()
          Returns the queue on which all messages to the Repository are sent.
static ChannelID getTheSched()
          Returns the queue on which HarvestControllers reply with status messages to the HarvestScheduler.
static ChannelID getThisIndexClient()
          Returns the queue for getting responses from the IndexServer application.
static ChannelID getThisReposClient()
          Returns the one-per-client queue on which client receives replies from the arcrepository.
static boolean isTopic(java.lang.String name)
          Is a given name a ChannelName for a Topic or a Queue.
(package private) static void reset()
          Reset the instance to re-read the settings.
static ChannelID retrieveReplicaChannelFromReplicaId(java.lang.String replicaId)
          The method for retrieving the identification channel for a replica based on the Id of this replica.
static java.lang.String retrieveReplicaChannelNameFromReplicaId(java.lang.String replicaId)
          The method for retrieving the name of the identification channel for a replica based on the Id of this replica.
static Replica retrieveReplicaFromIdentifierChannel(java.lang.String channelName)
          Method for extracting the replica from the name of the identifier channel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHANNEL_PART_SEPARATOR

public static final java.lang.String CHANNEL_PART_SEPARATOR
Channel part separator.

See Also:
Constant Field Values
Method Detail

getReplicas

public static java.util.Collection<Replica> getReplicas()
Method for retrieving the list of replicas used for the channels. The replica ids are in the same order as their channels.

Returns:
The replica ids in the same order as their channels.

getTheSched

public static ChannelID getTheSched()
Returns the queue on which HarvestControllers reply with status messages to the HarvestScheduler.

Returns:
the ChannelID object for the queue on which HarvestControllers reply with status messages to the HarvestScheduler

getAnyHighpriorityHaco

public static ChannelID getAnyHighpriorityHaco()
Returns the queue which is used by the scheduler to send doOneCrawl to Harvest Controllers of high priority (selective harvests).

Returns:
That channel (queue)

getAnyLowpriorityHaco

public static ChannelID getAnyLowpriorityHaco()
Returns the queue which is used by the scheduler to send doOneCrawl to Harvest Controllers of low priority (snapshot harvests).

Returns:
That channel (queue)

getThisReposClient

public static ChannelID getThisReposClient()
Returns the one-per-client queue on which client receives replies from the arcrepository.

Returns:
the ChannelID object for this queue.

getTheRepos

public static ChannelID getTheRepos()
Returns the queue on which all messages to the Repository are sent.

Returns:
the ChannelID object for this queue.

getAllArchives_BAMONs

public static final ChannelID[] getAllArchives_BAMONs()
Returns BAMON channels for every known bitarchive (replica).

Returns:
An array of BAMON channels - one per bitarchive (replica)

getTheBamon

public static ChannelID getTheBamon()
                             throws IllegalState
Returns the queue for sending messages to bitarchive monitors.

Returns:
the ChannelID object for this queue.
Throws:
IllegalState - If the current replica is not a checksum replica.

getAllArchives_CRs

public static final ChannelID[] getAllArchives_CRs()
Returns the channels for the all Checksum replicas.

Returns:
An array of THE_CR channels - one for each replica, though only the checksum replicas have values (the others are null).

getTheCR

public static ChannelID getTheCR()
                          throws IllegalState
Method for retrieving the 'THE_CR' channel for this replica. If the replica is not a checksum replica, then an error is thrown.

Returns:
the 'THE_CR' channel for this replica.
Throws:
IllegalState - If the current replica is not a checksum replica.

getAllArchives_ALL_BAs

public static final ChannelID[] getAllArchives_ALL_BAs()
Returns ALL_BA channels for every known bitarchive.

Returns:
An array of ALL_BA channels - one per bitarchive

getAllBa

public static ChannelID getAllBa()
                          throws IllegalState
Returns the topic that all bitarchive machines on this replica are listening on.

Returns:
A topic channel that reaches all local bitarchive machines
Throws:
IllegalState - If the current replica is not a bitarchive replica.

getAllArchives_ANY_BAs

public static final ChannelID[] getAllArchives_ANY_BAs()
Returns ANY_BA channels for every known bitarchive.

Returns:
An array of ANY_BA channels - one per bitarchive

getAnyBa

public static ChannelID getAnyBa()
                          throws IllegalState
Returns the channel where exactly one of all the bitarchive machines at this replica will get the message.

Returns:
A queue channel that reaches one of the local bitarchive machines.
Throws:
IllegalState - If the current replica is not a bitarchive replica.

getError

public static ChannelID getError()
Returns the queue on which to put errors which are not handled elsewhere.

Returns:
the ChannelID object for this queue.

getBaMonForReplica

public static ChannelID getBaMonForReplica(java.lang.String replicaId)
                                    throws ArgumentNotValid
Given an replica, returns the BAMON queue to which batch jobs must be sent in order to run them on that bitarchive.

Parameters:
replicaId - The id of the replica
Returns:
the channel
Throws:
ArgumentNotValid - if the replicaId is null, unknown, or empty string

getTheCrForReplica

public static ChannelID getTheCrForReplica(java.lang.String replicaId)

retrieveReplicaFromIdentifierChannel

public static Replica retrieveReplicaFromIdentifierChannel(java.lang.String channelName)
                                                    throws UnknownID,
                                                           ArgumentNotValid
Method for extracting the replica from the name of the identifier channel.

Parameters:
channelName - The name of the identification channel for the replica.
Returns:
Replica who the identification channel belong to.
Throws:
UnknownID - If the replicaId does not point to a know replica.
ArgumentNotValid - If the channelName is either null or empty.

retrieveReplicaChannelNameFromReplicaId

public static java.lang.String retrieveReplicaChannelNameFromReplicaId(java.lang.String replicaId)
                                                                throws UnknownID,
                                                                       ArgumentNotValid
The method for retrieving the name of the identification channel for a replica based on the Id of this replica.

Parameters:
replicaId - The id for the replica whose identification channel name should be retrieved.
Returns:
The name of the identification channel for the replica.
Throws:
UnknownID - If no replica with the given replica id is known.
ArgumentNotValid - If the replicaId is null or empty.

retrieveReplicaChannelFromReplicaId

public static ChannelID retrieveReplicaChannelFromReplicaId(java.lang.String replicaId)
                                                     throws UnknownID,
                                                            ArgumentNotValid
The method for retrieving the identification channel for a replica based on the Id of this replica.

Parameters:
replicaId - The id for the replica whose identification channel name should be retrieved.
Returns:
The identification channel for the replica.
Throws:
UnknownID - If no replica with the given replica id is known.
ArgumentNotValid - If the replicaId is null or empty.

getTheIndexServer

public static ChannelID getTheIndexServer()
Returns the queue for sending messages to the IndexServer application.

Returns:
the ChannelID object for this queue.

getThisIndexClient

public static ChannelID getThisIndexClient()
Returns the queue for getting responses from the IndexServer application.

Returns:
the ChannelID object for this queue.

getTheMonitorServer

public static ChannelID getTheMonitorServer()
Return the queue for the monitor registry.

Returns:
the ChannelID object for the queue.

getHarvestMonitorChannel

public static ChannelID getHarvestMonitorChannel()
Return the queue for the harvest monitor registry.

Returns:
the ChannelID object for the queue.

getHarvestDispatcherChannel

public static ChannelID getHarvestDispatcherChannel()
Return the queue for the harvest dispatcher.

Returns:
the ChannelID object for the queue.

reset

static void reset()
Reset the instance to re-read the settings. Only for use in tests.


isTopic

public static boolean isTopic(java.lang.String name)
Is a given name a ChannelName for a Topic or a Queue.

Parameters:
name - a given name
Returns:
true, if arg name contains the string "_ALL_"