Package org.jboss.as.controller

Examples of org.jboss.as.controller.OperationFailedException


            } else if (prop.getName().equals("type")) {
                metric.get(prop.getName()).set(prop.getValue().asString());
            }
        }
        if (!metric.get("type").isDefined()) {
            throw new OperationFailedException(new ModelNode().set(MESSAGES.typeAttributeRequired("add-metric")));
        }
        if (!dynamicLoadProvider.isDefined()) {
            // Create a default one.
            dynamicLoadProvider.get(CommonAttributes.HISTORY).set(9);
            dynamicLoadProvider.get(CommonAttributes.DECAY).set(2);
View Full Code Here


            } else if (prop.getName().equals("class")) {
                metric.get(prop.getName()).set(prop.getValue().asString());
            }
        }
        if (!metric.get("class").isDefined()) {
            throw new OperationFailedException(
                    new ModelNode().set(MESSAGES.classAttributeRequired("add-custom-metric")));
        }
        if (!dynamicLoadProvider.isDefined()) {
            // Create a default one.
            dynamicLoadProvider.get(CommonAttributes.HISTORY).set(9);
View Full Code Here

            if (prop.getName().equals("port")) {
                port = Integer.parseInt(ContextHost.RemoveQuotes(prop.getValue().toString()));
            }
        }
        if (host == null || port == 0)
            throw new OperationFailedException(new ModelNode().set(MESSAGES.needContextAndHost()));

        host = ContextHost.RemoveQuotes(host);
    }
View Full Code Here

        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

            // Could have relative-to
            if (value.hasDefined(RELATIVE_TO.getName())) {
                final String relativeTo = value.get(RELATIVE_TO.getName()).asString();
                // Can't be an absolute path
                if (AbstractPathService.isAbsoluteUnixOrWindowsPath(relativeTo)) {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidRelativeTo(relativeTo)));
                }
            }
        }
    }
View Full Code Here

        if (value.isDefined()) {
            final String suffix = value.asString();
            try {
                new SimpleDateFormat(suffix);
                if (suffix.contains("s") || suffix.contains("S")) {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidSuffix(suffix)));
                }
            } catch (IllegalArgumentException e) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidSuffix(suffix)));
            }
        }
    }
View Full Code Here

                }
            }
        }

        if (!attached.isEmpty()) {
            throw new OperationFailedException(LoggingMessages.MESSAGES.handlerAttachedToLoggers(handlerName, attached));
        }

        // Check Async handlers
        final ModelNode asyncHandlers = subsystem.get(CommonAttributes.ASYNC_HANDLER);
        for (Property asyncHandler : asyncHandlers.asPropertyList()) {
            if (asyncHandler.getValue().hasDefined(CommonAttributes.SUBHANDLERS.getName())) {
                final ModelNode subhandlers = asyncHandler.getValue().get(CommonAttributes.SUBHANDLERS.getName());
                for (ModelNode handler : subhandlers.asList()) {
                    if (handlerName.equals(handler.asString())) {
                        attached.add(asyncHandler.getName());
                    }
                }
            }
        }

        if (!attached.isEmpty()) {
            throw new OperationFailedException(LoggingMessages.MESSAGES.handlerAttachedToHandlers(handlerName, attached));
        }
    }
View Full Code Here

    @Override
    protected void populateModel(ModelNode operation, ModelNode modelNode) throws OperationFailedException {
        for (SimpleAttributeDefinition attribute : CONNECTIONDEFINITIONS_NODEATTRIBUTE) {
            if (!attribute.isAllowed(operation) && operation.hasDefined(attribute.getName())) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalid(attribute.getName())));
            }
            attribute.validateAndSet(operation, modelNode);
        }

View Full Code Here

                    .addListener(verificationHandler).install();

            serviceControllers.add(controller);

        } catch (ValidateException e) {
            throw new OperationFailedException(e, operation);
        }
    }
View Full Code Here

                                } else if (Constants.REQUEST_COUNT.equals(attributeName)) {
                                    result.set("" + info.getRequestCount());
                                }
                            }
                        } catch (Exception e) {
                            throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToGetMetrics(e.getMessage())));
                        }
                    } else {
                        context.getResult().set(MESSAGES.noMetricsAvailable());
                    }
                    context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER);
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.