Package org.jboss.dmr

Examples of org.jboss.dmr.ModelNode.asList()


    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {

        validator.validate(operation);
        String jndiName = operation.require(CommonAttributes.JNDI_BINDING).asString();
        final ModelNode entries = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS).getModel().get(CommonAttributes.ENTRIES.getName());
        for (ModelNode entry : entries.asList()) {
            if (jndiName.equals(entry.asString())) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.jndiNameAlreadyRegistered(jndiName)));
            }
        }
        entries.add(jndiName);
View Full Code Here


        childrenNamesOp.get(OP).set(READ_CHILDREN_NAMES_OPERATION);
        childrenNamesOp.get(OP_ADDR).set(parentAddress);
        childrenNamesOp.get(CHILD_TYPE).set(last.getName());

        final ModelNode result = executeForResult(client, childrenNamesOp);
        if(result.asList().contains(last.getValue())) {
            return true;
        }
        return false;
    }
View Full Code Here

            ModelNode response = executor.doCommand(addressPath + ":read-resource");
            ModelNode result = response.get("result");
            if (!result.isDefined()) return;

            List<String> childrenTypes = getChildrenTypes(addressPath);
            for (ModelNode node : result.asList()) {
                Property prop = node.asProperty();
                if (childrenTypes.contains(prop.getName())) { // resource node
                    if (hasGenericOperations(addressPath, prop.getName())) {
                        add(new ManagementModelNode(new UserObject(prop.getName())));
                    }
View Full Code Here

            }
        }

        public void actionPerformed(ActionEvent ae) {
            ModelNode requestProperties = opDescription.get("result", "request-properties");
            if ((requestProperties == null) || (!requestProperties.isDefined()) || requestProperties.asList().isEmpty()) {
                cmdText.setText(addressPath + ":" + opName);
                cmdText.requestFocus();
                return;
            }
View Full Code Here

                if (resultNode.hasDefined(Util.STEP_1)) {
                    ModelNode typesOutcome = resultNode.get(Util.STEP_1);
                    if (Util.isSuccess(typesOutcome)) {
                        if (typesOutcome.hasDefined(Util.RESULT)) {
                            final ModelNode resourceResult = typesOutcome.get(Util.RESULT);
                            final List<ModelNode> types = resourceResult.asList();
                            if (!types.isEmpty()) {
                                typeNames = new ArrayList<String>();
                                for (ModelNode type : types) {
                                    typeNames.add(type.asString());
                                }
View Full Code Here

        if (sasl.hasDefined(QOP)) {
            builder.set(Options.SASL_QOP, Sequence.of(asQopSet(sasl.get(QOP))));
        }
        if (sasl.hasDefined(STRENGTH)) {
            ModelNode strength = sasl.get(STRENGTH);
            for (ModelNode current : strength.asList()) {
                builder.set(Options.SASL_STRENGTH, strengthFromString(current.asString()));
            }
        }
        if (sasl.hasDefined(SERVER_AUTH)) {
            builder.set(Options.SASL_SERVER_AUTH, sasl.get(SERVER_AUTH).asBoolean());
View Full Code Here

    private HashSet<String> getConnectorList() throws Exception {

        ModelNode op = createOpNode("subsystem=web", "read-children-names");
        op.get("child-type").set("connector");
        ModelNode result = executeOperation(op);
        List<ModelNode> connectors = result.asList();
        HashSet<String> connNames = new HashSet<String>();
        for (ModelNode n : connectors) {
            connNames.add(n.asString());
        }
View Full Code Here

        operation.get(NAME).set("list");
        result = executeForResult(operation);
        assertNotNull(result);
        assertEquals(ModelType.LIST, result.getType());
        List<ModelNode> list = result.asList();
        assertEquals(2, list.size());
        assertEquals("l1A", list.get(0).asString());
        assertEquals("l1B", list.get(1).asString());

        operation.get(NAME).set("non-existant-attribute");
View Full Code Here

    private void writeAliases(XMLExtendedStreamWriter writer, Attribute attribute, ModelNode container, String key) throws XMLStreamException {
        if (container.hasDefined(key)) {
            StringBuffer result = new StringBuffer() ;
            ModelNode aliases = container.get(key);
            if (aliases.isDefined() && aliases.getType() == ModelType.LIST) {
                List<ModelNode> aliasesList = aliases.asList();
                for (int i = 0; i < aliasesList.size(); i++) {
                    result.append(aliasesList.get(i).asString());
                    if (i < aliasesList.size()-1) {
                        result.append(" ");
                    }
View Full Code Here

        operation.get(CHILD_TYPE).set("subsystem");

        ModelNode result = executeForResult(operation);
        assertNotNull(result);
        assertEquals(ModelType.LIST, result.getType());
        assertEquals(2, result.asList().size());
        List<String> names =  modelNodeListToStringList(result.asList());
        assertTrue(names.contains("subsystem1"));
        assertTrue(names.contains("subsystem2"));

        operation = createOperation(READ_CHILDREN_NAMES_OPERATION, "profile", "profileA", "subsystem", "subsystem1");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.