if (!ZKUtil.isClusterSetup(clusterName, _zkClient))
{
throw new HelixException("cluster " + clusterName + " is not setup yet");
}
IdealStateModeProperty mode = IdealStateModeProperty.AUTO;
try
{
mode = IdealStateModeProperty.valueOf(idealStateMode);
}
catch (Exception e)
{
logger.error("", e);
}
IdealState idealState = new IdealState(resourceName);
idealState.setNumPartitions(partitions);
idealState.setStateModelDefRef(stateModelRef);
idealState.setIdealStateMode(mode.toString());
idealState.setReplicas("" + 0);
idealState.setStateModelFactoryName(HelixConstants.DEFAULT_STATE_MODEL_FACTORY);
if(maxPartitionsPerInstance > 0 && maxPartitionsPerInstance < Integer.MAX_VALUE)
{
idealState.setMaxPartitionsPerInstance(maxPartitionsPerInstance);