Java Code Examples for org.apache.helix.model.HelixConfigScope.ConfigScopeProperty#CLUSTER

The following examples show how to use org.apache.helix.model.HelixConfigScope.ConfigScopeProperty#CLUSTER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigScope.java    From helix with Apache License 2.0 5 votes vote down vote up
public ConfigScope(ConfigScopeBuilder configScopeBuilder) {
  Map<ConfigScopeProperty, String> scopeMap = configScopeBuilder.getScopeMap();
  List<String> keys = new ArrayList<String>();

  ConfigScopeProperty curScope = null;
  for (ConfigScopeProperty scope : scopePriority) {
    if (scopeMap.containsKey(scope)) {
      if (curScope == null && scope == ConfigScopeProperty.CLUSTER) {
        keys.add(scopeMap.get(scope));
        curScope = ConfigScopeProperty.CLUSTER;
      } else if (curScope == null) {
        throw new IllegalArgumentException("Missing CLUSTER scope. Can't build scope using "
            + configScopeBuilder);
      } else {
        if (!scopeTransition.containsKey(curScope)
            || !scopeTransition.get(curScope).containsKey(scope)) {
          throw new IllegalArgumentException("Can't build scope using " + configScopeBuilder);
        }
        keys.add(scopeMap.get(scope));
        curScope = scopeTransition.get(curScope).get(scope);
      }
    }
  }

  if (curScope == ConfigScopeProperty.CLUSTER) {
    // append one more {clusterName}
    keys.add(scopeMap.get(ConfigScopeProperty.CLUSTER));
  }

  String scopeStr = template.instantiate(curScope, keys.toArray(new String[0]));

  _clusterName = keys.get(0);
  _scopeStr = scopeStr;
  _scope = curScope;
}
 
Example 2
Source File: PropertyKey.java    From helix with Apache License 2.0 4 votes vote down vote up
/**
 * Get a property key associated with all cluster configurations
 * @return {@link PropertyKey}
 */

public PropertyKey clusterConfigs() {
  return new PropertyKey(CONFIGS, ConfigScopeProperty.CLUSTER, ClusterConfig.class,
      _clusterName, ConfigScopeProperty.CLUSTER.toString());
}
 
Example 3
Source File: PropertyKey.java    From helix with Apache License 2.0 4 votes vote down vote up
/**
 * Get a property key associated with this cluster configuration
 * @return {@link PropertyKey}
 */
public PropertyKey clusterConfig() {
  return new PropertyKey(CONFIGS, ConfigScopeProperty.CLUSTER, ClusterConfig.class,
      _clusterName, ConfigScopeProperty.CLUSTER.toString(), _clusterName);
}