for (int i = 0; i < count; i++) {
final String value = reader.getAttributeValue(i);
if (!isNoNamespaceAttribute(reader, i)) {
throw ParseUtils.unexpectedAttribute(reader, i);
} else {
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case NAME: {
if (name != null)
throw ParseUtils.duplicateAttribute(reader, attribute.getLocalName());
if (!jvmNames.add(value)) {
throw MESSAGES.duplicateDeclaration("JVM", value, reader.getLocation());
}
name = value;
break;
}
case JAVA_HOME: {
if (home != null)
throw ParseUtils.duplicateAttribute(reader, attribute.getLocalName());
home = value;
final ModelNode update = Util.getWriteAttributeOperation(null, JVMHandlers.JVM_JAVA_HOME, home);
attrUpdates.add(update);
break;
}
case TYPE: {
try {
// Validate the type against the enum
Enum.valueOf(JvmType.class, value);
type = value;
} catch (final IllegalArgumentException e) {
throw ParseUtils.invalidAttributeValue(reader, i);
}
break;
}
case DEBUG_ENABLED: {
if (!server) {
throw ParseUtils.unexpectedAttribute(reader, i);
}
if (debugEnabled != null) {
throw ParseUtils.duplicateAttribute(reader, attribute.getLocalName());
}
debugEnabled = Boolean.valueOf(value);
final ModelNode update = Util.getWriteAttributeOperation(null, JVMHandlers.JVM_DEBUG_ENABLED,
debugEnabled);
attrUpdates.add(update);
break;
}
case DEBUG_OPTIONS: {
if (!server) {
throw ParseUtils.unexpectedAttribute(reader, i);
}
if (debugOptions != null) {
throw ParseUtils.duplicateAttribute(reader, attribute.getLocalName());
}
debugOptions = value;
final ModelNode update = Util.getWriteAttributeOperation(null, JVMHandlers.JVM_DEBUG_OPTIONS,
debugOptions);
attrUpdates.add(update);
break;
}
case ENV_CLASSPATH_IGNORED: {
if (envClasspathIgnored != null)
throw ParseUtils.duplicateAttribute(reader, attribute.getLocalName());
envClasspathIgnored = Boolean.valueOf(value);
final ModelNode update = Util.getWriteAttributeOperation(null, JVMHandlers.JVM_ENV_CLASSPATH_IGNORED,
envClasspathIgnored);
attrUpdates.add(update);
break;