Package org.apache.solr.client.solrj.impl

## Interface ClusterStateProvider

All Superinterfaces:
  `AutoCloseable`, `Closeable`, `SolrCloseable`

All Known Implementing Classes:
  `BaseHttpClusterStateProvider`, `DelegatingClusterStateProvider`, `Http2ClusterStateProvider`, `HttpClusterStateProvider`

    public interface ClusterStateProvider
    extends SolrCloseable

Provides cluster state from some source

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Default Methods
`void` `connect()`
`Map<String,​String>` `getAliasProperties​(String alias)` Return alias properties, or an empty map if the alias has no properties.
`Map<String,​Object>` `getClusterProperties()` Obtain cluster properties.
`default Object` `getClusterProperty​(String propertyName)` Obtain a cluster property, or null if it doesn't exist.
`default <T> T` `getClusterProperty​(String key, T defaultValue)` Obtain a cluster property, or the default value if it doesn't exist.
`ClusterState` `getClusterState()` Obtain the current cluster state.
`default DocCollection` `getCollection​(String name)`
`Set<String>` `getLiveNodes()` Obtain set of live_nodes for the cluster.
`String` `getPolicyNameByCollection​(String coll)` Get the collection-specific policy
`String` `getQuorumHosts()`
`ClusterState.CollectionRef` `getState​(String collection)` Obtain the state of the collection (cluster status).
`default boolean` `isRoutedAlias​(String alias)` Returns true if an alias exists and is a routed alias, false otherwise.
`static ClusterStateProvider` `newZkClusterStateProvider​(Collection<String> zkHosts, String zkChroot, boolean canUseZkACLs)`
`List<String>` `resolveAlias​(String alias)` Given a collection alias, returns a list of collections it points to, or returns a singleton list of the input if it's not an alias.
`default String` `resolveSimpleAlias​(String alias)` Given a collection alias, return a single collection it points to, or the original name if it's not an alias.

### Methods inherited from interface java.io.Closeable

`close`

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

`isClosed`

### Method Detail

#### newZkClusterStateProvider

    static ClusterStateProvider newZkClusterStateProvider​(Collection<String> zkHosts,
                                                          String zkChroot,
                                                          boolean canUseZkACLs)

#### getState

    ClusterState.CollectionRef getState​(String collection)

Obtain the state of the collection (cluster status).

Returns:
  the collection state, or null is collection doesn't exist

#### getLiveNodes

    Set<String> getLiveNodes()

Obtain set of live_nodes for the cluster.

#### resolveAlias

    List<String> resolveAlias​(String alias)

Given a collection alias, returns a list of collections it points to, or returns a singleton list of the input if it's not an alias.

#### getAliasProperties

    Map<String,​String> getAliasProperties​(String alias)

Return alias properties, or an empty map if the alias has no properties.

#### resolveSimpleAlias

    default String resolveSimpleAlias​(String alias)
                               throws IllegalArgumentException

Given a collection alias, return a single collection it points to, or the original name if it's not an alias.

Throws:
  `IllegalArgumentException` - if an alias points to more than 1 collection, either directly or indirectly.

#### isRoutedAlias

    default boolean isRoutedAlias​(String alias)

Returns true if an alias exists and is a routed alias, false otherwise.

#### getClusterState

    ClusterState getClusterState()

Obtain the current cluster state.

#### getCollection

    default DocCollection getCollection​(String name)
                                 throws IOException

Throws:
  `IOException`

#### getClusterProperties

    Map<String,​Object> getClusterProperties()

Obtain cluster properties.

Returns:
  configured cluster properties, or an empty map, never null.

#### getClusterProperty

    default <T> T getClusterProperty​(String key,
                                     T defaultValue)

Obtain a cluster property, or the default value if it doesn't exist.

#### getClusterProperty

    default Object getClusterProperty​(String propertyName)

Obtain a cluster property, or null if it doesn't exist.

#### getPolicyNameByCollection

    String getPolicyNameByCollection​(String coll)

Get the collection-specific policy

#### connect

    void connect()

#### getQuorumHosts

    String getQuorumHosts()