Package org.apache.solr.common.cloud
Class ClusterProperties
- java.lang.Object
-
- org.apache.solr.common.cloud.ClusterProperties
-
public class ClusterProperties extends Object
Interact with solr cluster propertiesNote that all methods on this class make calls to ZK on every invocation. For read-only eventually-consistent uses, clients should instead call
ZkStateReader.getClusterProperty(String, Object)
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXT_PROPRTTY_PREFIX
-
Constructor Summary
Constructors Constructor Description ClusterProperties(SolrZkClient client)
Creates a ClusterProperties object using a provided SolrZkClient
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
getClusterProperties()
Return the cluster properties<T> T
getClusterProperty(String key, T defaultValue)
Read the value of a cluster property, returning a default if it is not set<T> T
getClusterProperty(List<String> key, T defaultValue)
Read the value of a cluster property, returning a default if it is not setvoid
setClusterProperties(Map<String,Object> properties)
void
setClusterProperty(String propertyName, Object propertyValue)
This method sets a cluster property.void
update(MapWriter obj, String... path)
Set this object at the json path
-
-
-
Field Detail
-
EXT_PROPRTTY_PREFIX
public static final String EXT_PROPRTTY_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClusterProperties
public ClusterProperties(SolrZkClient client)
Creates a ClusterProperties object using a provided SolrZkClient
-
-
Method Detail
-
getClusterProperty
public <T> T getClusterProperty(String key, T defaultValue) throws IOException
Read the value of a cluster property, returning a default if it is not set- Type Parameters:
T
- the type of the property- Parameters:
key
- the property name or the full path to the property.defaultValue
- the default value- Returns:
- the property value
- Throws:
IOException
- if there is an error reading the value from the cluster
-
getClusterProperty
public <T> T getClusterProperty(List<String> key, T defaultValue) throws IOException
Read the value of a cluster property, returning a default if it is not set- Type Parameters:
T
- the type of the property- Parameters:
key
- the property name or the full path to the property as a list of parts.defaultValue
- the default value- Returns:
- the property value
- Throws:
IOException
- if there is an error reading the value from the cluster
-
getClusterProperties
public Map<String,Object> getClusterProperties() throws IOException
Return the cluster properties- Throws:
IOException
- if there is an error reading properties from the cluster
-
setClusterProperties
public void setClusterProperties(Map<String,Object> properties) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
- Throws:
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
update
public void update(MapWriter obj, String... path) throws org.apache.zookeeper.KeeperException, InterruptedException
Set this object at the json path- Parameters:
obj
- the Object to be setpath
- the json path- Throws:
org.apache.zookeeper.KeeperException
InterruptedException
-
setClusterProperty
public void setClusterProperty(String propertyName, Object propertyValue) throws IOException
This method sets a cluster property.- Parameters:
propertyName
- The property name to be set.propertyValue
- The value of the property, could also be a nested structure.- Throws:
IOException
- if there is an error writing data to the cluster
-
-