}
else if (cmd.hasOption(listStateModel))
{
String clusterName = cmd.getOptionValues(listStateModel)[0];
String stateModel = cmd.getOptionValues(listStateModel)[1];
StateModelDefinition stateModelDef =
setupTool.getClusterManagementTool().getStateModelDef(clusterName, stateModel);
String result =
new String(new ZNRecordSerializer().serialize(stateModelDef.getRecord()));
System.out.println("StateModelDefinition: " + result);
return 0;
}
else if (cmd.hasOption(addStateModelDef))
{
String clusterName = cmd.getOptionValues(addStateModelDef)[0];
String stateModelFile = cmd.getOptionValues(addStateModelDef)[1];
ZNRecord stateModelRecord =
(ZNRecord) (new ZNRecordSerializer().deserialize(readFile(stateModelFile)));
if (stateModelRecord.getId() == null || stateModelRecord.getId().length() == 0)
{
throw new IllegalArgumentException("ZNRecord for state model definition must have an id");
}
setupTool.getClusterManagementTool()
.addStateModelDef(clusterName,
stateModelRecord.getId(),
new StateModelDefinition(stateModelRecord));
return 0;
}
else if (cmd.hasOption(addIdealState))
{
String clusterName = cmd.getOptionValues(addIdealState)[0];