當前位置: 首頁>>代碼示例>>Java>>正文


Java ModelNode.isDefined方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jmesnil,項目名稱:wildfly-microprofile-health,代碼行數:23,代碼來源:WildFlyResponseFactory.java

示例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);
}
 
開發者ID:jmesnil,項目名稱:wildfly-microprofile-health,代碼行數:44,代碼來源:SubsystemAdd.java

示例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());
        }
    }
}
 
開發者ID:wildfly,項目名稱:wildfly-nosql,代碼行數:10,代碼來源:Neo4jDefinition.java

示例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();
}
 
開發者ID:RestComm,項目名稱:smpp-extensions,代碼行數:39,代碼來源:SmppSubsystemParser.java

示例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;
}
 
開發者ID:RestComm,項目名稱:smpp-extensions,代碼行數:11,代碼來源:SmppService.java

示例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;
}
 
開發者ID:RestComm,項目名稱:smpp-extensions,代碼行數:11,代碼來源:SmppService.java

示例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;
}
 
開發者ID:RestComm,項目名稱:smpp-extensions,代碼行數:9,代碼來源:SmppService.java


注:本文中的org.jboss.dmr.ModelNode.isDefined方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。