Package org.jboss.as.controller

Examples of org.jboss.as.controller.OperationFailedException


        if (value.isDefined()) {
            final String levelString = value.asString();
            try {
                final Level level = ModelParser.parseLevel(value);
                if (!allowedValues.contains(level)) {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidLogLevel(levelString)));
                }
            } catch (IllegalArgumentException e) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidLogLevel(levelString)));
            }
        }
    }
View Full Code Here


        try {
            if (encoding.isDefined())
                service.setEncoding(encoding.asString());
        } catch (Throwable t) {
            throw new OperationFailedException(new ModelNode().set(t.getLocalizedMessage()));
        }

        if (formatter.isDefined()) {
            service.setFormatterSpec(AbstractFormatterSpec.fromModelNode(context, model));
        }
View Full Code Here

        if (value.isDefined()) {
            final String oaString = value.asString();
            try {
                final OverflowAction overflowAction = ModelParser.parseOverflowAction(value);
                if (overflowAction == null || !allowedValues.contains(overflowAction)) {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidOverflowAction(oaString)));
                }
            } catch (IllegalArgumentException e) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidOverflowAction(oaString)));
            }
        }
    }
View Full Code Here

            newControllers.add(target.addService(LogServices.loggerName(name), service)
                    .addListener(verificationHandler)
                    .setInitialMode(ServiceController.Mode.ACTIVE)
                    .install());
        } catch (Throwable t) {
            throw new OperationFailedException(new ModelNode().set(t.getLocalizedMessage()));
        }
        try {
            // install logger handler services
            final ModelNode handlers = HANDLERS.resolveModelAttribute(context, model);
            if (handlers.isDefined()) {
                newControllers.addAll(LogServices.installLoggerHandlers(target, name, handlers, verificationHandler));
            }
        } catch (Throwable t) {
            throw new OperationFailedException(new ModelNode().set(t.getLocalizedMessage()));
        }
    }
View Full Code Here

                    .setInitialMode(ServiceController.Mode.ACTIVE)
                    .install());


        } catch (Throwable t) {
            throw new OperationFailedException(new ModelNode().set(t.getLocalizedMessage()));
        }
        try {
            // install logger handler services
            if (handlers.isDefined()) {
                newControllers.addAll(LogServices.installLoggerHandlers(target, name, handlers, verificationHandler));
            }
        } catch (Throwable t) {
            throw new OperationFailedException(new ModelNode().set(t.getLocalizedMessage()));
        }
    }
View Full Code Here

            final String replacement = CommonAttributes.REPLACEMENT.resolveModelAttribute(context, node).asString();
            final boolean replaceAll = CommonAttributes.REPLACE_ALL.resolveModelAttribute(context, node).asBoolean();
            return new SubstituteFilter(pattern, replacement, replaceAll);
        }
        final String name = node.hasDefined(CommonAttributes.FILTER.getName()) ? node.get(CommonAttributes.FILTER.getName()).asString() : node.asString();
        throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidFilter(name)));
    }
View Full Code Here

     * @throws OperationFailedException if the size is invalid.
     */
    public static long parseSize(final ModelNode node) throws OperationFailedException {
        final Matcher matcher = SIZE_PATTERN.matcher(node.asString());
        if (!matcher.matches()) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidSize(node.asString())));
        }
        long qty = Long.parseLong(matcher.group(1), 10);
        final String chr = matcher.group(2);
        if (chr != null) {
            switch (chr.charAt(0)) {
                case 'b':
                case 'B':
                    break;
                case 'k':
                case 'K':
                    qty <<= 10L;
                    break;
                case 'm':
                case 'M':
                    qty <<= 20L;
                    break;
                case 'g':
                case 'G':
                    qty <<= 30L;
                    break;
                case 't':
                case 'T':
                    qty <<= 40L;
                    break;
                default:
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidSize(node.asString())));
            }
        }
        return qty;
    }
View Full Code Here

     */
    public static Level parseLevel(final ModelNode node) throws OperationFailedException {
        try {
            return Level.parse(node.asString());
        } catch (IllegalArgumentException e) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidLogLevel(node.asString())));
        }
    }
View Full Code Here

     */
    public static OverflowAction parseOverflowAction(final ModelNode node) throws OperationFailedException {
        try {
            return OverflowAction.valueOf(node.asString());
        } catch (IllegalArgumentException e) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidOverflowAction(node.asString())));
        }
    }
View Full Code Here

        final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
        final String name = address.getLastElement().getValue();
        final ServiceController<?> controller = context.getServiceRegistry(false).getService(DeploymentScannerService.getServiceName(name));
        if (controller == null) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.scannerNotConfigured()));
        } else {
            DeploymentScanner scanner = (DeploymentScanner) controller.getValue();
            updateScanner(scanner, newValue);
            handbackHolder.setHandback(scanner);
        }
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.