Class ReplicaId
- java.lang.Object
-
- org.opends.server.replication.common.ReplicaId
-
- All Implemented Interfaces:
Comparable<ReplicaId>
,ServerId<ReplicaId>
public final class ReplicaId extends Object implements ServerId<ReplicaId>
Represents the server ID for a replica, called a replica ID.The Server ID for a replica is represented both with a name and a numeric value:
- The name is a string, used for user interfaces (configuration, logs, monitoring, ...)
- The numeric value is an integer, needed because it is used in CSNs (there is no intent to change this) and for compatibility with previous replication protocol versions. The numeric id should not be exposed in user interfaces.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ReplicaId
allReplicas()
Returns the special id corresponding to "all replicas".int
compareTo(ReplicaId o)
boolean
equals(Object o)
static ReplicaId
fromNumericId(int numericId)
Generates a newReplicaId
from the provided integer value.static ReplicaId
fromReplicaName(String name)
Generates a newReplicaId
from the provided string value.int
hashCode()
boolean
isAllReplicas()
Tests whether this id corresponds to all replicas.boolean
isBackwardCompatibleWithNumericId()
Returns if the serverId can be used as identifier with replication protocol versions before V11.boolean
isNullReplicaId()
Tests whether this id corresponds to the null replica id.String
normalizedName()
Returns the normalized name of this serverId.static ReplicaId
nullReplicaId()
Returns the special id corresponding to the null replica id.int
numericId()
Returns the numeric value of this serverId, as an int.String
toString()
-
-
-
Method Detail
-
allReplicas
public static ReplicaId allReplicas()
Returns the special id corresponding to "all replicas".- Returns:
- the "all replica" id
-
nullReplicaId
public static ReplicaId nullReplicaId()
Returns the special id corresponding to the null replica id.- Returns:
- the null replica id
-
fromNumericId
public static ReplicaId fromNumericId(int numericId)
Generates a newReplicaId
from the provided integer value.- Parameters:
numericId
- the numeric part of this replica ID- Returns:
- a new
ReplicaId
-
fromReplicaName
public static ReplicaId fromReplicaName(String name)
Generates a newReplicaId
from the provided string value.- Parameters:
name
- the name of this replica ID- Returns:
- a new
ReplicaId
-
normalizedName
public String normalizedName()
Description copied from interface:ServerId
Returns the normalized name of this serverId.- Specified by:
normalizedName
in interfaceServerId<ReplicaId>
- Returns:
- this serverId as a (normalized)
String
value
-
numericId
public int numericId()
Description copied from interface:ServerId
Returns the numeric value of this serverId, as an int.The numeric value is used in the CSNs.
-
isAllReplicas
public boolean isAllReplicas()
Tests whether this id corresponds to all replicas.- Returns:
true
iff the id corresponds to the "all replicas" id
-
isNullReplicaId
public boolean isNullReplicaId()
Tests whether this id corresponds to the null replica id.- Returns:
true
iff the id is the null replica id.
-
isBackwardCompatibleWithNumericId
public boolean isBackwardCompatibleWithNumericId()
Description copied from interface:ServerId
Returns if the serverId can be used as identifier with replication protocol versions before V11.- Specified by:
isBackwardCompatibleWithNumericId
in interfaceServerId<ReplicaId>
- Returns:
- if the serverId can be used as identifier with replication protocol versions before V11
-
compareTo
public int compareTo(ReplicaId o)
- Specified by:
compareTo
in interfaceComparable<ReplicaId>
-
-