.addStep(Operations.createReadAttributeOperation(address.clone().add("log-file", file.asString()), "last-modified-time")); result = client.execute(builder.build()); ModelNode fileListing = new ModelNode().setEmptyList(); if (Operations.isSuccessfulOutcome(result)) {
return execute(builder.build());
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); final ModelNode slave = opBuilder.build().getOperation(); transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress()));
localCacheTransactionAddOperation.get(MODE_ATTR_NAME).set(MODE_ATTR_VALUE); compositeOperationBuilder.addStep(localCacheTransactionAddOperation); configurationManagement.executeManagementOperation(compositeOperationBuilder.build().getOperation()); context.getLogger().debugf("Server cache added to Infinispan subsystem configuration."); return ServerMigrationTaskResult.SUCCESS;
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); final ModelNode slave = opBuilder.build().getOperation(); transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress()));
context.attach(OperationAttachments.SLAVE_SERVER_OPERATION_TRANSMUTERS, transformers = new ArrayList<>()); final ModelNode slave = opBuilder.build().getOperation(); transformers.add(new OverlayOperationTransmuter(slave, context.getCurrentAddress()));
final ModelNode electionPolicyAddOperation = Util.createAddOperation(electionPolicyPathAddress); compositeOperationBuilder.addStep(electionPolicyAddOperation); serverConfiguration.executeManagementOperation(compositeOperationBuilder.build().getOperation());
private void processResources(final ModelControllerClient client, final MavenModelControllerClientConfiguration configuration, final Resource... resources) throws IOException { final Collection<String> profiles = getProfiles(); final boolean isDomain = ServerHelper.isDomainServer(client); for (Resource resource : resources) { if (isDomain && profiles.isEmpty()) { throw new IllegalStateException("Cannot add resources when no profiles were defined."); } if (isDomain) { // Profiles are required when adding resources in domain mode 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)) { // Execute the add resource operation reportFailure(client.execute(compositeOperationBuilder.build())); } } } else { final CompositeOperationBuilder compositeOperationBuilder = CompositeOperationBuilder.create(); if (addCompositeResource(null, client, resource, address, compositeOperationBuilder, true)) { // Execute the add resource operation reportFailure(client.execute(compositeOperationBuilder.build())); } } } }
/** * Creates an undeploy operation for each deployment description. * <p> * If the {@link UndeployDescription#isRemoveContent()} returns {@code true} the content will also be removed from * the content repository. Otherwise the content will remain on the server and only the {@code undeploy} operation * will be executed. * </p> * <p> * Note that the {@link UndeployDescription#isFailOnMissing() failOnMissing} is ignored and the operation will fail * if any deployments being undeployed are missing. * </p> * * @param undeployDescriptions the set of descriptions used to crate the operation * * @return the undeploy operation */ public static Operation createUndeployOperation(final Set<UndeployDescription> undeployDescriptions) { Assertions.requiresNotNullOrNotEmptyParameter("undeployDescriptions", undeployDescriptions); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (UndeployDescription undeployDescription : undeployDescriptions) { addUndeployOperationStep(builder, undeployDescription); } return builder.build(); }
/** * Creates an undeploy operation. * <p> * If the {@link UndeployDescription#isRemoveContent()} returns {@code true} the content will also be removed from * the content repository. Otherwise the content will remain on the server and only the {@code undeploy} operation * will be executed. * </p> * <p> * Note that the {@link UndeployDescription#isFailOnMissing() failOnMissing} is ignored and the operation will fail * if any deployments being undeployed are missing. * </p> * * @param undeployDescription the description used to crate the operation * * @return the undeploy operation */ public static Operation createUndeployOperation(final UndeployDescription undeployDescription) { Assert.checkNotNullParam("undeployDescription", undeployDescription); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addUndeployOperationStep(builder, undeployDescription); return builder.build(); }
/** * Creates a redeploy operation for the deployment. * <p> * Note this does not upload new content. To add new content and deploy the new content see * {@link #createReplaceOperation(Set)}. * </p> * * @param deployments the set of deployments to redeploy * * @return the redeploy operation */ public static Operation createRedeployOperation(final Set<DeploymentDescription> deployments) { Assertions.requiresNotNullOrNotEmptyParameter("deployments", deployments); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (DeploymentDescription deployment : deployments) { addRedeployOperationStep(builder, deployment); } return builder.build(); }
@Override public DeploymentResult forceDeploy(final Deployment deployment) throws IOException { final DeploymentResult failedResult = validateDeployment(deployment); if (failedResult != null) { return failedResult; } if (hasDeployment(deployment.getName())) { // Special handling for domains if the deployment is already in the content repository if (isDomain()) { // Retrieve the currently deployment content description final DeploymentDescription current = getServerGroupDeployment(deployment.getName()); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); // Add a full-replace-deployment as well as add the deployment to any missing server groups DeploymentOperations.addReplaceOperationSteps(builder, deployment, current, true); return execute(builder.build()); } return redeploy(deployment); } return deploy(deployment); }
/** * Creates an operation to add deployment content to a running server for each deployment. If the deployment is set * to be {@linkplain Deployment#isEnabled() enabled} the content will also be deployed. * * @param deployments a set of deployments to deploy * * @return the deploy operation * * @see #createDeployOperation(Set) */ public static Operation createAddDeploymentOperation(final Set<Deployment> deployments) { Assertions.requiresNotNullOrNotEmptyParameter("deployments", deployments); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (Deployment deployment : deployments) { addDeploymentOperationStep(builder, deployment); } return builder.build(); }
/** * Creates a redeploy operation for the deployment. * <p> * Note this does not upload new content. To add new content and deploy the new content see * {@link #createReplaceOperation(Deployment)}. * </p> * * @param deployment the deployment to redeploy * * @return the redeploy operation */ public static Operation createRedeployOperation(final DeploymentDescription deployment) { Assert.checkNotNullParam("deployment", deployment); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addRedeployOperationStep(builder, deployment); return builder.build(); }
/** * Creates an operation to replace deployment content to a running server. The previous content is undeployed, then * the new content is deployed, followed by the previous content being removed. * * @param deployments the set deployment used to replace existing deployments which match the same name * * @return the deploy operation */ public static Operation createReplaceOperation(final Set<Deployment> deployments) { Assertions.requiresNotNullOrNotEmptyParameter("deployments", deployments); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (Deployment deployment : deployments) { addReplaceOperationSteps(builder, deployment); } return builder.build(); }
/** * Creates an operation to add deployment content to a running server. If the deployment is set to be * {@linkplain Deployment#isEnabled() enabled} the content will also be deployed. * * @param deployment the deployment to deploy * * @return the deploy operation * * @see #createDeployOperation(DeploymentDescription) */ public static Operation createAddDeploymentOperation(final Deployment deployment) { Assert.checkNotNullParam("deployment", deployment); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addDeploymentOperationStep(builder, deployment); return builder.build(); }
/** * Creates an option to deploy existing content to the runtime for each deployment * * @param deployments a set of deployments to deploy * * @return the deploy operation */ public static Operation createDeployOperation(final Set<DeploymentDescription> deployments) { Assertions.requiresNotNullOrNotEmptyParameter("deployments", deployments); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); for (DeploymentDescription deployment : deployments) { addDeployOperationStep(builder, deployment); } return builder.build(); }
/** * Creates an operation to replace deployment content to a running server. The previous content is undeployed, then * the new content is deployed, followed by the previous content being removed. * * @param deployment the deployment used to replace an existing deployment * * @return the deploy operation */ public static Operation createReplaceOperation(final Deployment deployment) { Assert.checkNotNullParam("deployment", deployment); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addReplaceOperationSteps(builder, deployment); return builder.build(); }
/** * Creates an operation to deploy existing deployment content to the runtime. * * @param deployment the deployment to deploy * * @return the deploy operation */ public static Operation createDeployOperation(final DeploymentDescription deployment) { Assert.checkNotNullParam("deployment", deployment); final CompositeOperationBuilder builder = CompositeOperationBuilder.create(true); addDeployOperationStep(builder, deployment); return builder.build(); }