Package org.jboss.as.cli.batch

Examples of org.jboss.as.cli.batch.Batch.toRequest()


        if(currentBatch.isEmpty()) {
            batchManager.discardActiveBatch();
            throw new CommandFormatException("The batch is empty.");
        }

        final ModelNode composite = batch.toRequest();
        ModelNode result;
        try {
            result = ctx.getModelControllerClient().execute(composite);
        } catch (Exception e) {
            throw new CommandFormatException("Failed to execute batch: " + e.getLocalizedMessage());
View Full Code Here


                    batch.add(ctx.toBatchedCommand(cmd));
                } catch (CommandFormatException e) {
                    throw new IllegalArgumentException(String.format("Command '%s' is invalid. %s", cmd, e.getLocalizedMessage()), e);
                }
            }
            final ModelNode result = ctx.getModelControllerClient().execute(batch.toRequest());
            if (!ServerOperations.isSuccessfulOutcome(result)) {
                throw new IllegalArgumentException(ServerOperations.getFailureDescriptionAsString(result));
            }
        }
    }
View Full Code Here

            ctx.getBatchManager().activateNewBatch();
            Batch b = ctx.getBatchManager().getActiveBatch();
            b.add(ctx.toBatchedCommand("/socket-binding-group=standard-sockets/socket-binding=modcluster:add(multicast-port=23364, multicast-address=224.0.1.105)"));
            b.add(ctx.toBatchedCommand("/subsystem=modcluster:add"));
            b.add(ctx.toBatchedCommand("/subsystem=modcluster/mod-cluster-config=configuration:add(connector=http,advertise-socket=modcluster)"));
            request = b.toRequest();
            b.clear();
            ctx.getBatchManager().discardActiveBatch();

            response = controllerClient.execute(request);
            outcome = response.get("outcome").asString();
View Full Code Here

                throw new CommandLineException("catch block is empty.");
            }
        }

        if(tryBlock.isInTry()) {
            tryBlock.setTryRequest(batch.toRequest());
        } else {
            tryBlock.setCatchRequest(batch.toRequest());
        }
        tryBlock.setInFinally();
        batchManager.discardActiveBatch();
View Full Code Here

        }

        if(tryBlock.isInTry()) {
            tryBlock.setTryRequest(batch.toRequest());
        } else {
            tryBlock.setCatchRequest(batch.toRequest());
        }
        tryBlock.setInFinally();
        batchManager.discardActiveBatch();
        batchManager.activateNewBatch();
    }
View Full Code Here

        final Batch tryBatch = batchManager.getActiveBatch();
        if(tryBatch.size() == 0) {
            throw new CommandLineException("try block is empty.");
        }
        tryBlock.setTryRequest(tryBatch.toRequest());
        tryBlock.setInCatch();
        batchManager.discardActiveBatch();
        batchManager.activateNewBatch();
    }
}
View Full Code Here

        CommandLineException catchError = null;
        if(!Util.isSuccess(response)) {
            ctx.printLine("try block failed: " + Util.getFailureDescription(response));
            ModelNode catchRequest = tryBlock.getCatchRequest();
            if(catchRequest == null && tryBlock.isInCatch() && batch.size() > 0) {
                catchRequest = batch.toRequest();
            }
            if(catchRequest != null) {
                try {
                    response = client.execute(catchRequest);
                } catch (IOException e) {
View Full Code Here

                }
            }
        }

        if(tryBlock.isInFinally() && batch.size() > 0) {
            final ModelNode finallyRequest = batch.toRequest();
            try {
                response = client.execute(finallyRequest);
            } catch (IOException e) {
                throw new CommandLineException("finally request failed", e);
            }
View Full Code Here

            List<BatchedCommand> currentBatch = batch.getCommands();
            if(currentBatch.isEmpty()) {
                batchManager.discardActiveBatch();
                throw new CommandFormatException("The batch is empty.");
            }
            return batch.toRequest();
        }

        if(path != null) {
            final File f = new File(path);
            if(!f.exists()) {
View Full Code Here

                final Batch batch = batchManager.getActiveBatch();
                while(line != null) {
                    batch.add(ctx.toBatchedCommand(line));
                    line = reader.readLine();
                }
                return batch.toRequest();
            } catch(IOException e) {
                throw new CommandFormatException("Failed to read file " + f.getAbsolutePath(), e);
            } catch(CommandFormatException e) {
                throw new CommandFormatException("Failed to create batch from " + f.getAbsolutePath(), e);
            } finally {
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.