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
`static interface` `Replica.ReplicaStateProps` JSON properties related to a replica's state.
`static class` `Replica.State` The replica's state.
`static class` `Replica.Type`

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

`MapWriter.EntryWriter`

### Field Summary

Fields
`String` `collection`
`String` `core`
`String` `name`
`String` `node`
`String` `shard`
`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
`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

All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
`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()`
`void` `setState​(Replica.State state)` Deprecated.
`ZkNodeProps` `toFullProps()`
`String` `toString()`
`void` `writeMap​(MapWriter.EntryWriter ew)`

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

`containsKey, fromKeyVals, 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

`append, jsonStr, toMap, write`

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

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

### Field Detail

#### 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 Detail

#### 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 Detail

#### 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.

#### setState

    @Deprecated
    public void setState​(Replica.State state)

Deprecated.

#### 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

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()