Class CollectionProperties


  • public class CollectionProperties
    extends Object
    Interact with solr collection properties

    Note that all methods on this class make calls to ZK on every invocation. For read-only eventually-consistent uses, clients should instead call ZkStateReader.getCollectionProperties(String)

    • Constructor Detail

      • CollectionProperties

        public CollectionProperties​(SolrZkClient client)
        Creates a CollectionProperties object using a provided SolrZkClient
    • Method Detail

      • getCollectionProperty

        public String getCollectionProperty​(String collection,
                                            String key,
                                            String defaultValue)
                                     throws IOException
        Read the value of a collection property, returning a default if it is not set
        Parameters:
        key - the property name
        defaultValue - the default value
        Returns:
        the property value
        Throws:
        IOException - if there is an error reading the value from zookeeper
      • getCollectionProperties

        public Map<String,​String> getCollectionProperties​(String collection)
                                                         throws IOException
        Return the collection properties
        Throws:
        IOException - if there is an error reading properties from zookeeper
      • setCollectionProperty

        public void setCollectionProperty​(String collection,
                                          String propertyName,
                                          String propertyValue)
                                   throws IOException
        This method sets a collection property.
        Parameters:
        collection - The property name to be set.
        propertyName - The property name to be set.
        propertyValue - The value of the property.
        Throws:
        IOException - if there is an error writing data to zookeeper