Package org.apache.solr.common.cloud

# Class Replica

java.lang.Object
org.apache.solr.common.cloud.ZkNodeProps
org.apache.solr.common.cloud.Replica

All Implemented Interfaces:
  `MapSerializable`, `MapWriter`, `NavigableObject`, `org.noggit.JSONWriter.Writable`

public class Replica extends ZkNodeProps implements MapWriter

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`Replica.ReplicaStateProps`
JSON properties related to a replica's state.
`static enum`
`Replica.State`
The replica's state.
`static enum`
`Replica.Type`

## Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter

`MapWriter.EntryWriter`

## Field Summary

Fields
Modifier and Type
Field
Description
`final String`
`collection`
`final String`
`core`
`final String`
`name`
`final String`
`node`
`final String`
`shard`
`final Replica.Type`
`type`

### Fields inherited from class org.apache.solr.common.cloud.ZkNodeProps

`propMap`

### Fields inherited from interface org.apache.solr.common.MapWriter

`EMPTY`

## Constructor Summary

Constructors
Constructor
Description
`Replica(String name, String node, String collection, String shard, String core, Replica.State state, Replica.Type type, Map<String,Object> props)`
`Replica(String name, Map<String,Object> map, String collection, String shard)`
`Replica(Map<String,Object> nestedMap)`
This constructor uses a map with one key (coreNode name) and a value that is a map containing all replica properties.

## Method Summary

Modifier and Type
Method
Description
`Object`
`clone()`
`Replica`
`copyWith(PerReplicaStates.State state)`
`Replica`
`copyWith(Replica.State state)`
`boolean`
`equals(Object o)`
`Object`
`get(String key, Object defValue)`
`String`
`getBaseUrl()`
`String`
`getCollection()`
`String`
`getCoreName()`
SolrCore name.
`String`
`getCoreUrl()`
`String`
`getName()`
Also known as coreNodeName.
`String`
`getNodeName()`
The name of the node this replica resides on
`Map<String,Object>`
`getProperties()`
Get all properties as map.
`String`
`getProperty(String propertyName)`
`PerReplicaStates.State`
`getReplicaState()`
`String`
`getShard()`
`Replica.State`
`getState()`
Returns the `Replica.State` of this replica.
`static Replica.State`
`getState(String shortName)`
`Replica.Type`
`getType()`
`int`
`hashCode()`
`boolean`
`isActive(Set<String> liveNodes)`
`boolean`
`isLeader()`
`ZkNodeProps`
`toFullProps()`
`String`
`toString()`
`void`
`writeMap(MapWriter.EntryWriter ew)`
Writes this object's entries out to `ew`.

### Methods inherited from class org.apache.solr.common.cloud.ZkNodeProps

`containsKey, get, getBool, getInt, getStr, getStr, keySet, load, plus, plus, shallowCopy`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.apache.solr.common.MapWriter

`jsonStr, toMap, write`

### Methods inherited from interface org.apache.solr.common.NavigableObject

`_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size`

## Field Details

### name

public final String name

### node

public final String node

### core

public final String core

### type

public final Replica.Type type

### shard

public final String shard

### collection

public final String collection

## Constructor Details

### Replica

public Replica(String name, Map<String,Object> map, String collection, String shard)

### Replica

public Replica(String name, String node, String collection, String shard, String core, Replica.State state, Replica.Type type, Map<String,Object> props)

### Replica

public Replica(Map<String,Object> nestedMap)
This constructor uses a map with one key (coreNode name) and a value that is a map containing all replica properties.

Parameters:
  `nestedMap` - nested map containing replica properties

## Method Details

### getCollection

public String getCollection()

### getShard

public String getShard()

### getProperties

public Map<String,Object> getProperties()
Description copied from class: `ZkNodeProps`
Get all properties as map.

Overrides:
  `getProperties` in class `ZkNodeProps`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `ZkNodeProps`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `ZkNodeProps`

### getName

public String getName()
Also known as coreNodeName.

### getCoreUrl

public String getCoreUrl()

### getBaseUrl

public String getBaseUrl()

### getCoreName

public String getCoreName()
SolrCore name.

### getNodeName

public String getNodeName()
The name of the node this replica resides on

### getState

public Replica.State getState()
Returns the `Replica.State` of this replica.

### isActive

public boolean isActive(Set<String> liveNodes)

### getType

public Replica.Type getType()

### isLeader

public boolean isLeader()

### get

public Object get(String key, Object defValue)

### getProperty

public String getProperty(String propertyName)

### copyWith

public Replica copyWith(PerReplicaStates.State state)

### copyWith

public Replica copyWith(Replica.State state)

### getReplicaState

public PerReplicaStates.State getReplicaState()

### clone

public Object clone()

Overrides:
  `clone` in class `Object`

### getState

public static Replica.State getState(String shortName)

### writeMap

public void writeMap(MapWriter.EntryWriter ew) throws IOException
Description copied from interface: `MapWriter`
Writes this object's entries out to `ew`.

Specified by:
  `writeMap` in interface `MapWriter`
Overrides:
  `writeMap` in class `ZkNodeProps`
Throws:
  `IOException`

### toString

public String toString()

Overrides:
  `toString` in class `ZkNodeProps`

### toFullProps

public ZkNodeProps toFullProps()