本文整理汇总了Java中org.jboss.dmr.ModelNode.isDefined方法的典型用法代码示例。如果您正苦于以下问题:Java ModelNode.isDefined方法的具体用法?Java ModelNode.isDefined怎么用?Java ModelNode.isDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.dmr.ModelNode
的用法示例。
在下文中一共展示了ModelNode.isDefined方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setData
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
private Map<String,Object> setData(ModelNode model) {
if (!model.isDefined()) {
return null;
}
Map<String, Object> data = new HashMap<>();
for (String key : model.keys()) {
final ModelNode modelValue = model.get(key);
final Object value;
switch (modelValue.getType()) {
case LONG:
value = modelValue.asLong();
break;
case BOOLEAN:
value = modelValue.asBoolean();
break;
default:
value = modelValue.asString();
}
data.put(key, value);
}
return data;
}
示例2: performBoottime
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
MicroProfileHealthLogger.ROOT_LOGGER.activatingSubsystem();
HealthMonitorService.install(context);
String serverName = HTTP_SERVER.resolveModelAttribute(context, model).asString();
String vHostName = HTTP_VIRTUAL_HOST.resolveModelAttribute(context, model).asString();
ModelNode path = HTTP_PATH.resolveModelAttribute(context, model);
if (path.isDefined()) {
HealthHttpHandlerService.install(context, serverName, vHostName, path.asString());
}
/*
HealthCheckHelper.install(context, "heap-memory", () -> {
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
long memUsed = memoryBean.getHeapMemoryUsage().getUsed();
long memMax = memoryBean.getHeapMemoryUsage().getMax();
Response response = Response.named("heap-memory")
.withAttribute("used", memUsed)
.withAttribute("max", memMax)
// response is is down is used memory is greater than 90% of max memory.
.state((memUsed < memMax * 0.9) ? true : false);
return response;
});
*/
//Add deployment processors here
//Remove this if you don't need to hook into the deployers, or you can add as many as you like
//see SubDeploymentProcessor for explanation of the phases
context.addStep(new AbstractDeploymentChainStep() {
public void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(SubsystemExtension.SUBSYSTEM_NAME, DependencyProcessor.PHASE, DependencyProcessor.PRIORITY, new DependencyProcessor());
processorTarget.addDeploymentProcessor(SubsystemExtension.SUBSYSTEM_NAME, SubsystemDeploymentProcessor.PHASE, SubsystemDeploymentProcessor.PRIORITY, new SubsystemDeploymentProcessor());
}
}, OperationContext.Stage.RUNTIME);
}
示例3: validateParameter
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
@Override
public void validateParameter(String parameterName, ModelNode value) throws OperationFailedException {
if (value.isDefined()) {
String str = value.asString();
if (TransactionEnlistmentType.getFromStringValue(str) == null) {
throw ROOT_LOGGER.invalidParameter(CommonAttributes.TRANSACTION, str, TransactionEnlistmentType.allowedNames());
}
}
}
示例4: writeContent
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
context.startSubsystemElement(Namespace.CURRENT.getUriString(), false);
final ModelNode node = context.getModelNode();
final ModelNode mbean = node.get(SmppMbeanDefinition.MBEAN);
for (Property mbeanProp : mbean.asPropertyList()) {
writer.writeStartElement(SmppMbeanDefinition.MBEAN);
final ModelNode mbeanEntry = mbeanProp.getValue();
SmppMbeanDefinition.NAME_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
SmppMbeanDefinition.TYPE_ATTR.marshallAsAttribute(mbeanEntry, true, writer);
final ModelNode property = mbeanEntry.get(SmppMbeanPropertyDefinition.PROPERTY);
if (property != null && property.isDefined()) {
for (Property propertyProp : property.asPropertyList()) {
writer.writeStartElement(SmppMbeanPropertyDefinition.PROPERTY);
final ModelNode propertyEntry = propertyProp.getValue();
SmppMbeanPropertyDefinition.NAME_ATTR.marshallAsAttribute(propertyEntry, true, writer);
SmppMbeanPropertyDefinition.TYPE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
SmppMbeanPropertyDefinition.VALUE_ATTR.marshallAsAttribute(propertyEntry, true, writer);
writer.writeEndElement();
}
}
writer.writeEndElement();
}
writer.writeEndElement();
}
示例5: getPropertyString
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
private String getPropertyString(String mbeanName, String propertyName, String defaultValue) {
String result = defaultValue;
ModelNode propertyNode = peek(fullModel, "mbean", mbeanName, "property", propertyName);
if (propertyNode != null && propertyNode.isDefined()) {
// log.debug("propertyNode: "+propertyNode);
// todo: test TYPE?
result = propertyNode.get("value").asString();
}
return (result == null) ? defaultValue : result;
}
示例6: getPropertyInt
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
private int getPropertyInt(String mbeanName, String propertyName, int defaultValue) {
int result = defaultValue;
ModelNode propertyNode = peek(fullModel, "mbean", mbeanName, "property", propertyName);
if (propertyNode != null && propertyNode.isDefined()) {
// log.debug("propertyNode: "+propertyNode);
// todo: test TYPE?
result = propertyNode.get("value").asInt();
}
return result;
}
示例7: getPropertyBoolean
import org.jboss.dmr.ModelNode; //导入方法依赖的package包/类
private boolean getPropertyBoolean(String mbeanName, String propertyName, boolean defaultValue) {
boolean result = defaultValue;
ModelNode propertyNode = peek(fullModel, "mbean", mbeanName, "property", propertyName);
if (propertyNode != null && propertyNode.isDefined()) {
result = propertyNode.get("value").asBoolean();
}
return result;
}