Package org.jboss.as.controller

Examples of org.jboss.as.controller.OperationFailedException


            OperationResult handlerResult = null;

            final String attributeName = operation.require(NAME).asString();
            final AttributeAccess attributeAccess = context.getRegistry().getAttributeAccess(PathAddress.pathAddress(operation.get(OP_ADDR)), attributeName);
            if (attributeAccess == null) {
                throw new OperationFailedException(new ModelNode().set("No known attribute called " + attributeName)); // TODO i18n
            } else if (attributeAccess.getAccessType() != AccessType.READ_WRITE) {
                throw new OperationFailedException(new ModelNode().set("Attribute " + attributeName + " is not writeable")); // TODO i18n
            } else {
                handlerResult = attributeAccess.getWriteHandler().execute(context, operation, resultHandler);
            }

            return handlerResult;
View Full Code Here


                resultHandler.handleResultFragment(new String[0], result);
            } else {
                final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
                final Set<String> childNames = context.getRegistry().getChildNames(address);
                if (!childNames.contains(childName)) {
                    throw new OperationFailedException(new ModelNode().set("No known child called " + childName)); //TODO i18n
                } else {
                    final ModelNode result = new ModelNode();
                    subModel = subModel.get(childName);
                    if (!subModel.isDefined()) {
                        result.setEmptyList();
View Full Code Here

                resultHandler.handleResultComplete();
            } else {
                final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
                final Set<String> childNames = context.getRegistry().getChildNames(address);
                if (!childNames.contains(childName)) {
                    throw new OperationFailedException(new ModelNode().set("No known child called " + childName)); //TODO i18n
                } else {
                    final AtomicBoolean ok = new AtomicBoolean(true);
                    final ModelNode result = new ModelNode();
                    subModel = subModel.get(childName);
                    if (!subModel.isDefined()) {
View Full Code Here

            AbstractFormatterSpec.fromModelNode(context, resolvedValue).apply(handler);
        } else if (ENCODING.getName().equals(attributeName)) {
            try {
                handler.setEncoding(resolvedValue.asString());
            } catch (UnsupportedEncodingException e) {
                throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToSetHandlerEncoding()));
            }
        }
        return doApplyUpdateToRuntime(context, operation, attributeName, resolvedValue, currentValue, name, handler);
    }
View Full Code Here

                AbstractFormatterSpec.fromModelNode(context, valueToRestore).apply(handler);
            } else if (ENCODING.getName().equals(attributeName)) {
                try {
                    handler.setEncoding(valueToRestore.asString());
                } catch (UnsupportedEncodingException e) {
                    throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToSetHandlerEncoding()));
                }
            }
            doRevertUpdateToRuntime(context, operation, attributeName, valueToRestore, valueToRevert, name, handler);
        }
    }
View Full Code Here

     *
     * @return the exception.
     */
    static OperationFailedException createFailureMessage(final String description) {
        ModelNode failure = new ModelNode().set(description);
        return new OperationFailedException(failure);
    }
View Full Code Here

                        if (encoding.isDefined()) {
                            try {
                                handler.setEncoding(encoding.asString());
                            } catch (UnsupportedEncodingException e) {
                                throw new OperationFailedException(e, new ModelNode().set(MESSAGES.failedToSetHandlerEncoding()));
                            }
                        }

                        if (filter.isDefined()) {
                            handler.setFilter(ModelParser.parseFilter(context, filter));
View Full Code Here

        if (value.isDefined()) {
            for (String key : value.keys()) {
                if (allowedValues.containsKey(key)) {
                    allowedValues.get(key).getValidator().validateParameter(key, value.get(key));
                } else {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidValueTypeKey(key, allowedValues.keySet())));
                }
            }
        }
    }
View Full Code Here

    public void validateParameter(final String parameterName, final ModelNode value) throws OperationFailedException {
        super.validateParameter(parameterName, value);
        if (value.isDefined()) {
            final Target target = Target.fromString(value.asString());
            if (target == null || !allowedValues.contains(target)) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidTargetName(allowedValues)));
            }
        }
    }
View Full Code Here

        if (value.isDefined()) {
            final String stringValue = value.asString();
            try {
                ModelParser.parseSize(value);
            } catch (IllegalArgumentException e) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidSize(stringValue)));
            } catch (IllegalStateException e) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidSize(stringValue)));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.as.controller.OperationFailedException

Copyright © 2018 www.massapicom. 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.