Package org.jboss.as.controller

Examples of org.jboss.as.controller.OperationFailedException


            } else if ( USE_FAST_FAIL.getName().equals(attributeName)) {
                return boolValidator;
            } else if (POOL_FLUSH_STRATEGY.getName().equals(attributeName)) {
                return new EnumValidator(FlushStrategy.class, true, true);
            } else {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.invalidParameterName(attributeName)));
            }

        }
View Full Code Here


                    final ManagementRepository repository = (ManagementRepository) managementRepoService.getValue();
                    poolConfigs = getMatchingPoolConfigs(jndiName, repository);
                    updatePoolConfigs(poolConfigs, parameterName, newValue);
                    handbackHolder.setHandback(poolConfigs);
                } catch (Exception e) {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.failedToSetAttribute(e.getLocalizedMessage())));
                }
            }

            return ( IDLETIMEOUTMINUTES.getName().equals(parameterName) ||  BACKGROUNDVALIDATION.getName().equals(parameterName)
                    ||  BACKGROUNDVALIDATIONMILLIS.getName().equals(parameterName)
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

                // Retrieve the current service
                final ServiceRegistry registry = context.getServiceRegistry(true);
                final ServiceController<?> fileController = registry.getService(serviceName);
                if (fileController == null) {
                    throw new OperationFailedException(new ModelNode().set(MESSAGES.serviceNotFound(serviceName)));
                }
                final HandlerFileService fileService = (HandlerFileService) fileController.getService();
                fileService.setPath(path.asString());

                // Find the handler and set the new file
                @SuppressWarnings("unchecked")
                final ServiceController<?> handlerController = registry.getService(LogServices.handlerName(name));
                final AbstractFileHandlerService handlerService = (AbstractFileHandlerService) handlerController.getService();
                final String fileName = fileService.getValue();
                try {
                    handlerService.setFile(fileName);
                } catch (FileNotFoundException e) {
                    throw new OperationFailedException(e, new ModelNode().set(MESSAGES.fileNotFound(fileName)));
                }
            }
        }
        return requiresRestart;
    }
View Full Code Here

            // Retrieve the current service
            final ServiceRegistry registry = context.getServiceRegistry(true);
            final ServiceController<?> fileController = registry.getService(serviceName);
            if (fileController == null) {
                throw new OperationFailedException(new ModelNode().set(MESSAGES.serviceNotFound(serviceName)));
            }
            final HandlerFileService fileService = (HandlerFileService) fileController.getService();
            fileService.setPath(path.asString());

            // Find the handler and set the new file
            @SuppressWarnings("unchecked")
            final ServiceController<?> handlerController = registry.getService(LogServices.handlerName(name));
            final AbstractFileHandlerService handlerService = (AbstractFileHandlerService) handlerController.getService();
            final String fileName = fileService.getValue();
            try {
                handlerService.setFile(fileName);
            } catch (FileNotFoundException e) {
                throw new OperationFailedException(e, new ModelNode().set(MESSAGES.fileNotFound(fileName)));
            }
        }
    }
View Full Code Here

    public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
        final ModelNode virtualHost = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS).getModel();
        boolean enable = Boolean.parseBoolean(operation.get("value").toString());
        if(enable && virtualHost.hasDefined(Constants.DEFAULT_WEB_MODULE)) {
            // That is no supported.
            throw new OperationFailedException(MESSAGES.noWelcomeWebappWithDefaultWebModule());
        } else {
            virtualHost.get(Constants.ENABLE_WELCOME_ROOT).set(enable);
        }
        if (context.isNormalServer()) {
            context.reloadRequired();
View Full Code Here

                            for (StatisticsPlugin stat : stats) {

                                result.set("" + stat.getValue(attributeName));
                            }
                        } catch (Exception e) {
                            throw new OperationFailedException(MESSAGES.failedToGetMetrics(e.getLocalizedMessage()));
                        }
                    }
                   context.completeStep();
                }
            }, OperationContext.Stage.RUNTIME);
View Full Code Here

                            try {
                                final ModelNode result = context.getResult();
                                result.set("" + stats.getValue(attributeName));

                            } catch (Exception e) {
                               throw new OperationFailedException(MESSAGES.failedToGetMetrics(e.getLocalizedMessage()));
                            }
                        }
                        context.completeStep();
                    }
                }, OperationContext.Stage.RUNTIME);
View Full Code Here

     * Override to get the actual result from the response.
     */
    public ModelNode executeForResult(ModelNode operation) throws OperationFailedException {
        ModelNode rsp = getController().execute(operation, null, null, null);
        if (FAILED.equals(rsp.get(OUTCOME).asString())) {
            throw new OperationFailedException(rsp.get(FAILURE_DESCRIPTION));
        }
        return rsp.get(RESULT);
    }
View Full Code Here

                    target.addService(GroupBindingService.getBroadcastBaseServiceName(hqServiceName).append(name), bindingService)
                            .addInjectionValue(bindingService.getBindingRef(), new ImmediateValue<SocketBinding>(socketBinding))
                            .install();

                } catch (Exception e) {
                    throw new OperationFailedException(new ModelNode().set(e.getLocalizedMessage()));
                }
            }
        }
    }
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.