Search in sources :

Example 6 with ConfigDefinition

use of com.yahoo.vespa.config.buildergen.ConfigDefinition in project vespa by vespa-engine.

the class ServerCacheLoader method loadConfigDefinitionsFromPath.

/**
 * Loads config definitions from a specified path into server cache and returns it.
 *
 * @param appPath the path to load config definitions from
 */
private void loadConfigDefinitionsFromPath(ServerCache cache, String appPath) {
    if (!configCurator.exists(appPath))
        return;
    for (String nodeName : configCurator.getChildren(appPath)) {
        String payload = configCurator.getData(appPath, nodeName);
        ConfigDefinitionKey dKey = ConfigUtils.createConfigDefinitionKeyFromZKString(nodeName);
        cache.addDef(dKey, new ConfigDefinition(dKey.getName(), Splitter.on("\n").splitToList(payload).toArray(new String[0])));
    }
}
Also used : ConfigDefinition(com.yahoo.vespa.config.buildergen.ConfigDefinition) ConfigDefinitionKey(com.yahoo.vespa.config.ConfigDefinitionKey)

Aggregations

ConfigDefinition (com.yahoo.vespa.config.buildergen.ConfigDefinition)6 ConfigDefinitionKey (com.yahoo.vespa.config.ConfigDefinitionKey)3 ConfigurationRuntimeException (com.yahoo.config.ConfigurationRuntimeException)1 DefParser (com.yahoo.config.codegen.DefParser)1 ConfigCacheKey (com.yahoo.vespa.config.ConfigCacheKey)1 ConfigPayload (com.yahoo.vespa.config.ConfigPayload)1 ConfigResponse (com.yahoo.vespa.config.protocol.ConfigResponse)1 DefContent (com.yahoo.vespa.config.protocol.DefContent)1 UnknownConfigDefinitionException (com.yahoo.vespa.config.server.UnknownConfigDefinitionException)1 StringReader (java.io.StringReader)1 Before (org.junit.Before)1