dk.netarkivet.common.distribute.arcrepository
Class Replica

java.lang.Object
  extended by dk.netarkivet.common.distribute.arcrepository.Replica

public class Replica
extends java.lang.Object

This class encapsulates the bitarchive or checksum replicas. It guarantees that there is only one Replica object per replica id/name.


Method Summary
 ChannelID getChannelID()
          Get the BaMon channel id that corresponds to this replica.
 java.lang.String getId()
          Get the id of this replica.
static java.util.Collection<Replica> getKnown()
          Get all known replicas.
static java.lang.String[] getKnownIds()
          Get all known replicas as ids.
static java.lang.String[] getKnownNames()
          Get all known replica as names.
 java.lang.String getName()
          Get the name of this replica.
static Replica getReplicaFromId(java.lang.String id)
          Get an object representing the replica with the given id.
static Replica getReplicaFromName(java.lang.String name)
          Get an object representing the replica with the given name.
 ReplicaType getType()
          Get the type of this replica.
static boolean isKnownReplicaId(java.lang.String id)
          Check, if a given id is a replica id.
static boolean isKnownReplicaName(java.lang.String name)
          Check, if a given name is a replica name.
 java.lang.String toString()
          Returns a human-readable representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getReplicaFromId

public static Replica getReplicaFromId(java.lang.String id)
Get an object representing the replica with the given id.

Parameters:
id - The given name of an replica
Returns:
an object representing the replica with the given id
Throws:
UnknownID - if no replica is known with the given id

getReplicaFromName

public static Replica getReplicaFromName(java.lang.String name)
Get an object representing the replica with the given name.

Parameters:
name - The given name of an replica
Returns:
an object representing the replica with the given name
Throws:
UnknownID - if no replica is known with the given name

isKnownReplicaName

public static boolean isKnownReplicaName(java.lang.String name)
Check, if a given name is a replica name.

Parameters:
name - a given name
Returns:
true, if the given name is a replica name, false otherwise

isKnownReplicaId

public static boolean isKnownReplicaId(java.lang.String id)
Check, if a given id is a replica id.

Parameters:
id - a given id
Returns:
true, if the given id is a replica id, false otherwise

getKnown

public static java.util.Collection<Replica> getKnown()
Get all known replicas.

Returns:
A unmodifiable view of the currently known replicas.

getKnownIds

public static java.lang.String[] getKnownIds()
Get all known replicas as ids.

Returns:
all known replicas as ids

getKnownNames

public static java.lang.String[] getKnownNames()
Get all known replica as names.

Returns:
all known replicas as names

getType

public ReplicaType getType()
Get the type of this replica.

Returns:
The type of this replica (bitarchive or checksum).

getId

public java.lang.String getId()
Get the id of this replica.

Returns:
The id of this replica (also used in queues).

getName

public java.lang.String getName()
Get the name of this replica.

Returns:
The name of this replica is known as in interface.

getChannelID

public ChannelID getChannelID()
Get the BaMon channel id that corresponds to this replica.

Returns:
The BaMon ChannelID of this replica. Please do not parse its name!

toString

public java.lang.String toString()
Returns a human-readable representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
An arbitrary string version of the object. Do not depend on its format.