String clusterName = getValue("clusterName");
String scopeStr = getValue("scope").toUpperCase();
try
{
ConfigScopeProperty scopeProperty = ConfigScopeProperty.valueOf(scopeStr);
switch (scopeProperty)
{
case CLUSTER:
String scopeConfigStr =
ConfigScopeProperty.CLUSTER.toString() + "=" + clusterName;
setConfigs(entity, scopeConfigStr);
break;
case PARTICIPANT:
case RESOURCE:
String scopeKey1 = getValue("scopeKey1");
if (scopeKey1 == null)
{
throw new HelixException("Missing resourceName|participantName");
}
else
{
scopeConfigStr =
ConfigScopeProperty.CLUSTER.toString() + "=" + clusterName + ","
+ scopeProperty.toString() + "=" + scopeKey1;
setConfigs(entity, scopeConfigStr);
}
break;
case PARTITION:
scopeKey1 = getValue("scopeKey1");
String scopeKey2 = getValue("scopeKey2");
if (scopeKey1 == null || scopeKey2 == null)
{
throw new HelixException("Missing resourceName|partitionName");
}
else
{
scopeConfigStr =
ConfigScopeProperty.CLUSTER.toString() + "=" + clusterName + ","
+ ConfigScopeProperty.RESOURCE.toString() + "=" + scopeKey1 + ","
+ scopeProperty.toString() + "=" + scopeKey2;
setConfigs(entity, scopeConfigStr);
}
break;
default:
break;