}
public static Jvm model2JVM(BeanFactory factory, ModelNode model) {
Jvm jvm = null;
try {
if(model.hasDefined("jvm"))
{
// TODO: sometimes it returns "jvm={}" ...
if(model.get("jvm").asPropertyList().isEmpty()) // empty object
return null;
jvm = factory.jvm().as();
Property jvmProp = model.get("jvm").asProperty();
jvm.setName(jvmProp.getName());
ModelNode jvmPropValue = jvmProp.getValue();
if(jvmPropValue.hasDefined("heap-size"))
jvm.setHeapSize(jvmPropValue.get("heap-size").asString());
if(jvmPropValue.hasDefined("max-heap-size"))
jvm.setMaxHeapSize(jvmPropValue.get("max-heap-size").asString());
if(jvmPropValue.hasDefined("debug-enabled"))
jvm.setDebugEnabled(jvmPropValue.get("debug-enabled").asBoolean());
}
} catch (IllegalArgumentException e) {
// TODO: properly deal with the different representations