Class AnyConfigProducer

java.lang.Object
com.yahoo.config.model.producer.AnyConfigProducer
All Implemented Interfaces:
com.yahoo.config.ConfigInstance.Producer, ConfigProducer, Serializable
Direct Known Subclasses:
ClusterControllerConfig, DocumentDatabase, TreeConfigProducer, Tuning

public abstract class AnyConfigProducer extends Object implements ConfigProducer, com.yahoo.config.ConfigInstance.Producer, Serializable
Superclass for all config producers. Config producers constructs and returns config instances on request.
Author:
gjoranv, arnej
See Also:
  • Field Details

    • log

      public static final Logger log
  • Constructor Details

    • AnyConfigProducer

      public AnyConfigProducer(TreeConfigProducer parent, String subId)
      Creates a new AnyConfigProducer with the given parent and subId. This constructor will add the resulting producer to the children of parent.
      Parameters:
      parent - the parent of this ConfigProducer
      subId - the fragment of the config id for the producer
    • AnyConfigProducer

      public AnyConfigProducer(String subId)
      Create an config producer with a configId only. Used e.g. to create root nodes, and producers that are given parents after construction using TreeConfigProducer.addChild(AnyConfigProducer).
      Parameters:
      subId - The sub configId. Note that this can be prefixed when calling addChild with this producer as arg.
  • Method Details

    • stateIsHosted

      protected static boolean stateIsHosted(DeployState deployState)
    • remove

      protected void remove()
      Removes this from the config model
    • setParent

      protected final void setParent(TreeConfigProducer parent)
    • getSubId

      public final String getSubId()
    • setUserConfigs

      public void setUserConfigs(UserConfigRepo repo)
      Sets the user configs for this producer.
      Parameters:
      repo - User configs repo.
    • getUserConfigs

      public UserConfigRepo getUserConfigs()
      Returns the user configs of this
      Specified by:
      getUserConfigs in interface ConfigProducer
    • getConfigId

      public final String getConfigId()
      ConfigProducers that must have a special config id should use setConfigId() instead of overloading this method. This is because config IDs must be registered through setConfigId().
      Specified by:
      getConfigId in interface ConfigProducer
    • currentConfigId

      protected final String currentConfigId()
    • addConfigId

      protected void addConfigId(String id)
      Sets the config id for this producer. Will also add this service to the root node, so the new config id will be picked up. Note that this producer will be known with both the old and the new config id in the root node after using this method.
    • cascadeConfig

      public final boolean cascadeConfig(com.yahoo.config.ConfigInstance.Builder builder)
      Description copied from interface: ConfigProducer
      Build config from this and all parent ConfigProducers, such that the root node's config will be added first, and this ConfigProducer's config last in the returned builder.
      Specified by:
      cascadeConfig in interface ConfigProducer
      Parameters:
      builder - The builder implemented by the concrete ConfigInstance class
      Returns:
      true if a model config producer was found, so config was applied
    • addUserConfig

      public final boolean addUserConfig(com.yahoo.config.ConfigInstance.Builder builder)
      Description copied from interface: ConfigProducer
      Adds user config override from this ConfigProducer to the existing builder
      Specified by:
      addUserConfig in interface ConfigProducer
      Parameters:
      builder - The ConfigBuilder to add user config overrides.
      Returns:
      true if overrides were added, false if not.
    • hostSystem

      public HostSystem hostSystem()
      Returns the one and only HostSystem of the root node. Must be overridden by root node.
      Specified by:
      hostSystem in interface ConfigProducer
    • getRoot

      public AbstractConfigProducerRoot getRoot()
    • getParent

      public AnyConfigProducer getParent()
    • findInheritedClassLoader

      protected static ClassLoader findInheritedClassLoader(Class clazz, String producerName)
    • getConfigClassLoader

      protected ClassLoader getConfigClassLoader(String producerName)
    • mergeUserConfigs

      public void mergeUserConfigs(UserConfigRepo newRepo)
    • getMonitoringService

      protected Monitoring getMonitoringService()
      Returns a monitoring service if configured, null otherwise
    • getDescendantServices

      public List<Service> getDescendantServices()
      Description copied from interface: ConfigProducer
      Returns a List of all Services that are descendants to this ConfigProducer
      Specified by:
      getDescendantServices in interface ConfigProducer
    • validate

      public void validate() throws Exception
      Description copied from interface: ConfigProducer
      check constraints depending on the state of the vespamodel graph. When overriding, you must invoke super.
      Specified by:
      validate in interface ConfigProducer
      Throws:
      Exception