Package org.jboss.as.plugin.common.Operations

Examples of org.jboss.as.plugin.common.Operations.CompositeOperationBuilder


    public final void execute(final ModelControllerClient client) throws IOException {
        if (hasCommands()) {
            final CommandContext ctx = create();
            try {
                if (isBatch()) {
                    final CompositeOperationBuilder builder = CompositeOperationBuilder.create();
                    for (String cmd : getCommands()) {
                        try {
                            builder.addStep(ctx.buildRequest(cmd));
                        } catch (CommandFormatException e) {
                            throw new IllegalArgumentException(String.format("Command '%s' is invalid", cmd), e);
                        }
                    }
                    final ModelNode result = client.execute(builder.build());
                    if (!Operations.successful(result)) {
                        throw new IllegalArgumentException(Operations.getFailureDescription(result));
                    }
                } else {
                    for (String cmd : getCommands()) {
View Full Code Here


                final List<String> profiles = domain.getProfiles();
                if (profiles.isEmpty()) {
                    throw new IllegalStateException("Cannot add resources when no profiles were defined.");
                }
                for (String profile : profiles) {
                    final CompositeOperationBuilder compositeOperationBuilder = CompositeOperationBuilder.create();
                    if (addCompositeResource(profile, client, resource, address, compositeOperationBuilder, true)) {
                        if (resource.hasBeforeAddCommands()) {
                            resource.getBeforeAdd().execute(client);
                        }
                        // Execute the add resource operation
                        reportFailure(client.execute(compositeOperationBuilder.build()));

                        if (resource.hasAfterAddCommands()) {
                            resource.getAfterAdd().execute(client);
                        }
                    }
                }
            } else {
                final CompositeOperationBuilder compositeOperationBuilder = CompositeOperationBuilder.create();
                if (addCompositeResource(null, client, resource, address, compositeOperationBuilder, true)) {
                    if (resource.hasBeforeAddCommands()) {
                        resource.getBeforeAdd().execute(client);
                    }
                    // Execute the add resource operation
                    reportFailure(client.execute(compositeOperationBuilder.build()));

                    if (resource.hasAfterAddCommands()) {
                        resource.getAfterAdd().execute(client);
                    }
                }
View Full Code Here

TOP

Related Classes of org.jboss.as.plugin.common.Operations.CompositeOperationBuilder

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.