final Map<String, CommandArgument> argMap = new HashMap<String, CommandArgument>(propList.size());
for(int i = 0; i < propList.size(); ++i) {
final Property prop = propList.get(i);
final ModelNode propDescr = prop.getValue();
if(propDescr.has(Util.ACCESS_TYPE) && Util.READ_WRITE.equals(propDescr.get(Util.ACCESS_TYPE).asString())) {
ModelType type = null;
CommandLineCompleter valueCompleter = null;
ArgumentValueConverter valueConverter = null;
if(propConverters != null) {
valueConverter = propConverters.get(prop.getName());
}
if(valueConverter == null) {
valueConverter = ArgumentValueConverter.DEFAULT;
if(propDescr.has(Util.TYPE)) {
type = propDescr.get(Util.TYPE).asType();
if(ModelType.BOOLEAN == type) {
valueCompleter = SimpleTabCompleter.BOOLEAN;
} else if(prop.getName().endsWith("properties")) { // TODO this is bad but can't rely on proper descriptions
valueConverter = ArgumentValueConverter.PROPERTIES;
} else if(ModelType.LIST == type) {
if(propDescr.hasDefined(Util.VALUE_TYPE) && propDescr.get(Util.VALUE_TYPE).asType() == ModelType.PROPERTY) {
valueConverter = ArgumentValueConverter.PROPERTIES;
} else {
valueConverter = ArgumentValueConverter.LIST;
}
} else if(ModelType.OBJECT == type) {
valueConverter = ArgumentValueConverter.OBJECT;
}
}
}
final CommandArgument arg = new ArgumentWithValue(GenericTypeOperationHandler.this, valueCompleter, valueConverter, "--" + prop.getName());
argMap.put(arg.getFullName(), arg);
}
}
nodeProps = argMap;
}
return nodeProps;
} else {
// list operation properties
if(propsByOp == null) {
propsByOp = new HashMap<String, Map<String, CommandArgument>>();
}
Map<String, CommandArgument> opProps = propsByOp.get(op);
if(opProps == null) {
final ModelNode descr;
try {
descr = getOperationDescription(ctx, op);
} catch (IOException e1) {
return Collections.emptyMap();
}
if(descr == null || !descr.has(Util.REQUEST_PROPERTIES)) {
opProps = Collections.emptyMap();
} else {
final List<Property> propList = descr.get(Util.REQUEST_PROPERTIES).asPropertyList();
opProps = new HashMap<String,CommandArgument>(propList.size());
for (Property prop : propList) {
final ModelNode propDescr = prop.getValue();
ModelType type = null;
CommandLineCompleter valueCompleter = null;
ArgumentValueConverter valueConverter = null;
if(propConverters != null) {
valueConverter = propConverters.get(prop.getName());
}