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
 java.lang.String getId()
          Get the id of this replica.
 ChannelID getIdentificationChannel()
          Get the identification channel that corresponds to 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.util.Set<java.lang.String> getKnownIdsAsSet()
          Get the id of all known replicas as a string set.
static java.lang.String[] getKnownNames()
          Get names of all known replicas as string array.
static java.util.Set<java.lang.String> getKnownNamesAsSet()
          Get the names of all known replicas as a string set.
 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

getKnownIdsAsSet

public static java.util.Set<java.lang.String> getKnownIdsAsSet()
Get the id of all known replicas as a string set.

Returns:
The id of all known replicas as a string set.

getKnownNames

public static java.lang.String[] getKnownNames()
Get names of all known replicas as string array.

Returns:
The names of all known replicas as a string array.

getKnownNamesAsSet

public static java.util.Set<java.lang.String> getKnownNamesAsSet()
Get the names of all known replicas as a string set.

Returns:
The names of all known replicas as a string set.

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.

getIdentificationChannel

public ChannelID getIdentificationChannel()
Get the identification channel that corresponds to this replica. Please do not parse its name!

Returns:
The BaMon ChannelID of this replica.

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.