protected void removeDs() throws Exception { final ModelNode removeOperation = Operations.createRemoveOperation(baseAddress); removeOperation.get(ModelDescriptionConstants.OPERATION_HEADERS).get("allow-resource-service-restart").set(true); executeOperation(removeOperation); }
private void removeChildRecursive(Node current, OrderedOperationsCollection operations, ImmutableManagementResourceRegistration registration, boolean dropForReadd) { //The remove operations get processed in reverse order by the operations collection, so add the parent //remove before the child remove if (registration.getOperationHandler(PathAddress.EMPTY_ADDRESS, REMOVE) != null) { final ModelNode op = Operations.createRemoveOperation(current.address.toModelNode()); if (dropForReadd) { op.get(OPERATION_HEADERS, SYNC_REMOVED_FOR_READD).set(true); } operations.add(op); } for (final Map.Entry<String, Map<PathElement, Node>> childrenByType : current.childrenByType.entrySet()) { for (final Node child : childrenByType.getValue().values()) { removeChildRecursive(child, operations, registration.getSubModel(PathAddress.pathAddress(child.element)), dropForReadd); } } }
@Override public void configure(ModelControllerClient controller) { ModelNode removeLoggingOp = createRemoveOperation(loggingSubsystemAddress()); try { ModelNode result = controller.execute(removeLoggingOp); if (isSuccessfulOutcome(result)) { reload(controller); } } catch (IOException e) { throw new RuntimeException("Unable to disable logging subsystem.", e); } }
private void removeChildRecursive(Node current, OrderedOperationsCollection operations, ImmutableManagementResourceRegistration registration, boolean dropForReadd) { //The remove operations get processed in reverse order by the operations collection, so add the parent //remove before the child remove if (registration.getOperationHandler(PathAddress.EMPTY_ADDRESS, REMOVE) != null) { final ModelNode op = Operations.createRemoveOperation(current.address.toModelNode()); if (dropForReadd) { op.get(OPERATION_HEADERS, SYNC_REMOVED_FOR_READD).set(true); } operations.add(op); } for (final Map.Entry<String, Map<PathElement, Node>> childrenByType : current.childrenByType.entrySet()) { for (final Node child : childrenByType.getValue().values()) { removeChildRecursive(child, operations, registration.getSubModel(PathAddress.pathAddress(child.element)), dropForReadd); } } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Set<String> runtimeNames = checkRequiredRuntimeNames(context, operation); ModelNode removeOperation = null; if (isRedeployAfterRemoval(operation)) { assert !runtimeNames.isEmpty(); assert runtimeNames.size() == 1; removeOperation = Operations.createRemoveOperation(context.getCurrentAddress().append(DEPLOYMENT, runtimeNames.iterator().next()).toModelNode()); } if (domainRoot) { AffectedDeploymentOverlay.redeployLinksAndTransformOperationForDomain(context, runtimeNames, removeOperation); } else { AffectedDeploymentOverlay.redeployLinksAndTransformOperation(context, removeOperation, context.getCurrentAddress().getParent(), runtimeNames); } if (isRedeployAfterRemoval(operation)) {//Now that the redeploy operations are ready we can remove the resource. context.removeResource(PathAddress.pathAddress(DEPLOYMENT, runtimeNames.iterator().next())); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { Set<String> runtimeNames = checkRequiredRuntimeNames(context, operation); ModelNode removeOperation = null; if (isRedeployAfterRemoval(operation)) { assert !runtimeNames.isEmpty(); assert runtimeNames.size() == 1; removeOperation = Operations.createRemoveOperation(context.getCurrentAddress().append(DEPLOYMENT, runtimeNames.iterator().next()).toModelNode()); } if (domainRoot) { AffectedDeploymentOverlay.redeployLinksAndTransformOperationForDomain(context, runtimeNames, removeOperation); } else { AffectedDeploymentOverlay.redeployLinksAndTransformOperation(context, removeOperation, context.getCurrentAddress().getParent(), runtimeNames); } if (isRedeployAfterRemoval(operation)) {//Now that the redeploy operations are ready we can remove the resource. context.removeResource(PathAddress.pathAddress(DEPLOYMENT, runtimeNames.iterator().next())); } }
private static void addUndeployOperationStep(final CompositeOperationBuilder builder, @SuppressWarnings("TypeMayBeWeakened") final UndeployDescription undeployDescription) { final String name = undeployDescription.getName(); final Set<String> serverGroups = undeployDescription.getServerGroups(); if (serverGroups.isEmpty()) { final ModelNode address = createAddress(DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_UNDEPLOY_OPERATION, address)); if (undeployDescription.isRemoveContent()) { builder.addStep(createRemoveOperation(address)); } } else { for (String serverGroup : serverGroups) { final ModelNode address = createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, name); builder.addStep(createOperation(DEPLOYMENT_UNDEPLOY_OPERATION, address)); if (undeployDescription.isRemoveContent()) { builder.addStep(createRemoveOperation(address)); } } if (undeployDescription.isRemoveContent()) { builder.addStep(createRemoveOperation(createAddress(DEPLOYMENT, name))); } } }
private void removeLogger(ModelNode node) throws IOException { final ModelNode result = managementClient.get().getControllerClient() .execute( Operations.createRemoveOperation( node ) ); if ( !Operations.isSuccessfulOutcome( result ) ) { logger.warning( "Can't remove " + node + " logger: " + result.toJSONString( false ) ); } }
public void beforeShutdown(@Observes BeforeStop event, ArquillianDescriptor descriptor) throws IOException { ModelNode result = managementClient.get().getControllerClient() .execute( Operations.createRemoveOperation( DATA_SOURCE_ADDRESS ) ); if ( !Operations.isSuccessfulOutcome( result ) ) { log.warning( "Can't remove data source: " + result.toJSONString( false ) ); } }