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


Java ModelNode.get方法代碼示例

本文整理匯總了Java中org.jboss.dmr.ModelNode.get方法的典型用法代碼示例。如果您正苦於以下問題:Java ModelNode.get方法的具體用法?Java ModelNode.get怎麽用?Java ModelNode.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jboss.dmr.ModelNode的用法示例。


在下文中一共展示了ModelNode.get方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: testClient

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testClient() throws Exception {
    ModelControllerClient client = ModelControllerClient.Factory.create(
            "localhost", 9990
    );

    ModelNode response = client.execute(
            Operations.createOperation("generate-jdr-report",
                                       Operations.createAddress("subsystem", "jdr")
            )
    );

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    ModelNode result = response.get("result");

    String reportLocation = result.get("report-location").asString();

    assertThat(reportLocation).endsWith(".zip");
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:22,代碼來源:JdrArquillianTest.java

示例3: performRuntime

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {

    final ModelNode profileEntry = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
    final Set<String> outboundSocketBindings = new HashSet<>();
    ConfigurationBuilder builder = new ConfigurationBuilder();
    if (profileEntry.hasDefined(CommonAttributes.ID_NAME)) {
        builder.setDescription(profileEntry.get(CommonAttributes.ID_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.JNDI_NAME)) {
        builder.setJNDIName(profileEntry.get(CommonAttributes.JNDI_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.MODULE_NAME)) {
        builder.setModuleName(profileEntry.get(CommonAttributes.MODULE_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.TRANSACTION)) {
        builder.setTransactionEnlistment(TransactionEnlistmentType.getFromStringValue(profileEntry.get(CommonAttributes.TRANSACTION).asString()));
    }
    if (profileEntry.hasDefined(CommonAttributes.HOST_DEF)) {
        ModelNode hostModels = profileEntry.get(CommonAttributes.HOST_DEF);
        for (ModelNode host : hostModels.asList()) {
            for (ModelNode hostEntry : host.get(0).asList()) {
                if (hostEntry.hasDefined(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF)) {
                    String outboundSocketBindingRef = hostEntry.get(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF).asString();
                    outboundSocketBindings.add(outboundSocketBindingRef);
                }
            }
        }
    }
    if (profileEntry.hasDefined(CommonAttributes.SECURITY_DOMAIN)) {
        builder.setSecurityDomain(profileEntry.get(CommonAttributes.SECURITY_DOMAIN).asString());
    }
    startNeo4jDriverService(context, builder, outboundSocketBindings);
}
 
開發者ID:wildfly,項目名稱:wildfly-nosql,代碼行數:35,代碼來源:Neo4jDefinition.java

示例4: getOutboundSocketBinding

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
private String getOutboundSocketBinding(ModelNode profileEntry) {
    if (profileEntry.hasDefined(CommonAttributes.HOST)) {
        ModelNode hostModels = profileEntry.get(CommonAttributes.HOST);
        for (ModelNode host : hostModels.asList()) {
            for (ModelNode hostEntry : host.get(0).asList()) {
                if (hostEntry.hasDefined(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF)) {
                    return hostEntry.get(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF).asString();
                }
            }
        }
    }

    return null;
}
 
開發者ID:wildfly,項目名稱:wildfly-nosql,代碼行數:15,代碼來源:OrientDefinition.java

示例5: performRuntime

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {

    final ModelNode profileEntry = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
    final Set<String> outboundSocketBindings = new HashSet<>();
    ConfigurationBuilder builder = new ConfigurationBuilder();
    if (profileEntry.hasDefined(CommonAttributes.ID_NAME)) {
        builder.setDescription(profileEntry.get(CommonAttributes.ID_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.JNDI_NAME)) {
        builder.setJNDIName(profileEntry.get(CommonAttributes.JNDI_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.MODULE_NAME)) {
        builder.setModuleName(profileEntry.get(CommonAttributes.MODULE_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.DATABASE)) {
        builder.setKeyspace(profileEntry.get(CommonAttributes.DATABASE).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.SSL)) {
        builder.setWithSSL(profileEntry.get(CommonAttributes.SSL).asBoolean());
    }
    if (profileEntry.hasDefined(CommonAttributes.HOST_DEF)) {
        ModelNode hostModels = profileEntry.get(CommonAttributes.HOST_DEF);
        for (ModelNode host : hostModels.asList()) {
            for (ModelNode hostEntry : host.get(0).asList()) {
                if (hostEntry.hasDefined(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF)) {
                    String outboundSocketBindingRef = hostEntry.get(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF).asString();
                    outboundSocketBindings.add(outboundSocketBindingRef);
                }
            }
        }
    }
    if (profileEntry.hasDefined(CommonAttributes.SECURITY_DOMAIN)) {
        builder.setSecurityDomain(profileEntry.get(CommonAttributes.SECURITY_DOMAIN).asString());
    }
    startCassandraDriverService(context, builder, outboundSocketBindings);
}
 
開發者ID:wildfly,項目名稱:wildfly-nosql,代碼行數:38,代碼來源:CassandraDefinition.java

示例6: 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

示例7: peek

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
private ModelNode peek(ModelNode node, String... args) {
    for (String arg : args) {
        if (!node.hasDefined(arg)) {
            return null;
        }
        node = node.get(arg);
    }
    return node;
}
 
開發者ID:RestComm,項目名稱:smpp-extensions,代碼行數:10,代碼來源:SmppService.java

示例8: unwrap

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
private static ModelNode unwrap(ModelNode response) {
    if (response.get(OUTCOME).asString().equals(SUCCESS)) {
        return response.get(RESULT);
    } else {
        return response;
    }
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:8,代碼來源:MonitorService.java

示例9: isAlreadyConfigured

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
default boolean isAlreadyConfigured(List<ModelNode> subList, List<ModelNode> list) {
    if (subList.isEmpty()) {
        return false;
    }

    ModelNode head = subList.get(0);
    ModelNode addr = head.get(OP_ADDR);

    return isAlreadyConfigured(addr, list);
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:11,代碼來源:ConfigurationMarshaller.java

示例10: performRuntime

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final ModelNode profileEntry = Resource.Tools.readModel(context.readResource(PathAddress.EMPTY_ADDRESS));
    final Set<String> outboundSocketBindings = new HashSet<>();
    ConfigurationBuilder builder = new ConfigurationBuilder();
    if (profileEntry.hasDefined(CommonAttributes.ID_NAME)) {
        builder.setDescription(profileEntry.get(CommonAttributes.ID_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.JNDI_NAME)) {
        builder.setJNDIName(profileEntry.get(CommonAttributes.JNDI_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.MODULE_NAME)) {
        builder.setModuleName(profileEntry.get(CommonAttributes.MODULE_NAME).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.DATABASE)) {
        builder.setDatabase(profileEntry.get(CommonAttributes.DATABASE).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.SECURITY_DOMAIN)) {
        builder.setSecurityDomain(profileEntry.get(CommonAttributes.SECURITY_DOMAIN).asString());
    }
    if (profileEntry.hasDefined(CommonAttributes.AUTH_TYPE)) {
        AuthType authType = AuthType.valueOf(profileEntry.get(CommonAttributes.AUTH_TYPE).asString());
        builder.setAuthType(authType);
    }
    if (profileEntry.hasDefined(CommonAttributes.SSL)) {
        builder.setSSL(profileEntry.get(CommonAttributes.SSL).asBoolean());
    }

    if (profileEntry.hasDefined(CommonAttributes.HOST_DEF)) {
        ModelNode hostModels = profileEntry.get(CommonAttributes.HOST_DEF);
        for (ModelNode host : hostModels.asList()) {
            for (ModelNode hostEntry : host.get(0).asList()) {
                if (hostEntry.hasDefined(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF)) {
                    String outboundSocketBindingRef = hostEntry.get(CommonAttributes.OUTBOUND_SOCKET_BINDING_REF).asString();
                    outboundSocketBindings.add(outboundSocketBindingRef);
                }
            }
        }
    }
    if (profileEntry.hasDefined(CommonAttributes.PROPERTIES)) {
        for (ModelNode propertyProfiles : profileEntry.get(CommonAttributes.PROPERTIES).asList()) {
            for (ModelNode propertyModels : propertyProfiles.get(0).asList()) {
                if (propertyModels.hasDefined(CommonAttributes.PROPERTY)) {
                    for (Property property : propertyModels.get(CommonAttributes.PROPERTY).asPropertyList()) {
                        if (property.getName().equals(CommonAttributes.WRITE_CONCERN)) {
                            builder.setWriteConcern(WriteConcernType.valueOf(property.getValue().asString()).name());
                        } else if (property.getName().equals(CommonAttributes.READ_CONCERN)) {
                            builder.setReadConcern(ReadConcernType.valueOf(property.getValue().asString()).name());
                        }
                    }
                }
            }
        }
    }
    startMongoDriverService(context, builder, outboundSocketBindings);
}
 
開發者ID:wildfly,項目名稱:wildfly-nosql,代碼行數:57,代碼來源:MongoDefinition.java

示例11: testClient

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testClient() throws Exception {

    Security.addProvider(new WildFlyElytronProvider());

    ModelControllerClient client = ModelControllerClient.Factory.create(
            "localhost", 9990, new AuthCallbackHandler("ManagementRealm", "bob", "tacos!")
    );

    ModelNode response = client.execute(Operations.createOperation("whoami"));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    ModelNode result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();

    ModelNode identity = result.get("identity");

    assertThat(identity).isNotNull();
    assertThat(identity.isDefined()).isTrue();

    assertThat(identity.get("username").asString()).isEqualTo("bob");

    // ===

    response = client.execute(Operations.createOperation("read-resource", PathAddress.pathAddress(PathElement.pathElement("deployment", "*")).toModelNode()));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();
    assertThat(result.getType()).isEqualTo(ModelType.LIST);
    assertThat(result.asList()).hasSize(1);

    ModelNode myapp = result.get(0);

    assertThat(myapp).isNotNull();
    assertThat(myapp.isDefined()).isTrue();

    ModelNode myappResult = myapp.get("result");

    assertThat(myappResult).isNotNull();
    assertThat(myappResult.isDefined()).isTrue();

    assertThat(myappResult.get("name").asString()).isEqualTo("myapp.jar");

}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:53,代碼來源:ArqSecuredManagementInterfaceWithPrecomputedPropertiesTest.java

示例12: testClient

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testClient() throws Exception {

    Security.addProvider(new WildFlyElytronProvider());

    ModelControllerClient client = ModelControllerClient.Factory.create(
            "localhost", 9990, new AuthCallbackHandler("TestRealm", "bob", "tacos!")
    );

    ModelNode response = client.execute(Operations.createOperation("whoami"));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    ModelNode result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();

    ModelNode identity = result.get("identity");

    assertThat(identity).isNotNull();
    assertThat(identity.isDefined()).isTrue();

    assertThat(identity.get("username").asString()).isEqualTo("bob");

    // ===

    response = client.execute(Operations.createOperation("read-resource", PathAddress.pathAddress(PathElement.pathElement("deployment", "*")).toModelNode()));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();
    assertThat(result.getType()).isEqualTo(ModelType.LIST);
    assertThat(result.asList()).hasSize(1);

    ModelNode myapp = result.get(0);

    assertThat(myapp).isNotNull();
    assertThat(myapp.isDefined()).isTrue();

    ModelNode myappResult = myapp.get("result");

    assertThat(myappResult).isNotNull();
    assertThat(myappResult.isDefined()).isTrue();

    assertThat(myappResult.get("name").asString()).isEqualTo("myapp.jar");

}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:53,代碼來源:ArqSecuredManagementInterfaceTest.java

示例13: testClient

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testClient() throws Exception {

    ModelControllerClient client = ModelControllerClient.Factory.create(
            "localhost", 9990
    );

    ModelNode response = client.execute(Operations.createOperation("whoami"));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    ModelNode result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();

    ModelNode identity = result.get("identity");

    assertThat(identity).isNotNull();
    assertThat(identity.isDefined()).isTrue();

    assertThat(identity.get("username").asString()).isEqualTo("anonymous");

    // ===

    response = client.execute(Operations.createOperation("read-resource", PathAddress.pathAddress(PathElement.pathElement("deployment", "*")).toModelNode()));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();
    assertThat(result.getType()).isEqualTo(ModelType.LIST);
    assertThat(result.asList()).hasSize(1);

    ModelNode myapp = result.get(0);

    assertThat(myapp).isNotNull();
    assertThat(myapp.isDefined()).isTrue();

    ModelNode myappResult = myapp.get("result");

    assertThat(myappResult).isNotNull();
    assertThat(myappResult.isDefined()).isTrue();

    assertThat(myappResult.get("name").asString()).isEqualTo("myapp.jar");


}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:52,代碼來源:ArqUnsecuredManagementInterfaceTest.java

示例14: testClient

import org.jboss.dmr.ModelNode; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testClient() throws Exception {

    Security.addProvider(new WildFlyElytronProvider());

    ModelControllerClient client = ModelControllerClient.Factory.create(
            "localhost", 9990, new AuthCallbackHandler("ManagementRealm", "bob", "tacos!")
    );

    ModelNode response = client.execute(Operations.createOperation("whoami"));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    ModelNode result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();

    ModelNode identity = result.get("identity");

    assertThat(identity).isNotNull();
    assertThat(identity.isDefined()).isTrue();

    assertThat(identity.get("username").asString()).isEqualTo("bob");

    // ===

    response = client.execute(Operations.createOperation("read-resource", PathAddress.pathAddress(PathElement.pathElement("deployment", "*")).toModelNode()));

    assertThat(response.get("outcome").asString()).isEqualTo("success");

    result = response.get("result");

    assertThat(result).isNotNull();
    assertThat(result.isDefined()).isTrue();
    assertThat(result.getType()).isEqualTo(ModelType.LIST);
    assertThat(result.asList()).hasSize(1);

    ModelNode myapp = result.get(0);

    assertThat(myapp).isNotNull();
    assertThat(myapp.isDefined()).isTrue();

    ModelNode myappResult = myapp.get("result");

    assertThat(myappResult).isNotNull();
    assertThat(myappResult.isDefined()).isTrue();

    assertThat(myappResult.get("name").asString()).isEqualTo("ArqSecuredManagementInterfaceTest.war");

}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:53,代碼來源:ArqSecuredManagementInterfaceTest.java


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