protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { final String deploymentName = PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue(); final Resource root = context.getRootResource(); if(root.hasChild(PathElement.pathElement(SERVER_GROUP))) { final List<String> badGroups = new ArrayList<String>(); for(final Resource.ResourceEntry entry : root.getChildren(SERVER_GROUP)) { if(entry.hasChild(PathElement.pathElement(DEPLOYMENT, deploymentName))) { badGroups.add(entry.getName()); } } if (badGroups.size() > 0) { String msg = String.format("Cannot remove deployment %s from the domain as it is still used by server groups %s", deploymentName, badGroups); throw new OperationFailedException(new ModelNode().set(msg)); } } super.performRemove(context, operation, model); }
protected void checkCanRemove(OperationContext context, ModelNode operation) throws OperationFailedException { final String deploymentName = PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue(); final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); if(root.hasChild(PathElement.pathElement(SERVER_GROUP))) { final List<String> badGroups = new ArrayList<String>(); for(final Resource.ResourceEntry entry : root.getChildren(SERVER_GROUP)) { if(entry.hasChild(PathElement.pathElement(DEPLOYMENT, deploymentName))) { badGroups.add(entry.getName()); } } if (badGroups.size() > 0) { throw new OperationFailedException(new ModelNode().set(MESSAGES.cannotRemoveDeploymentInUse(deploymentName, badGroups))); } } }
protected void checkCanRemove(OperationContext context, ModelNode operation) throws OperationFailedException { final String deploymentName = PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue(); final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); if(root.hasChild(PathElement.pathElement(SERVER_GROUP))) { final List<String> badGroups = new ArrayList<String>(); for(final Resource.ResourceEntry entry : root.getChildren(SERVER_GROUP)) { if(entry.hasChild(PathElement.pathElement(DEPLOYMENT, deploymentName))) { badGroups.add(entry.getName()); } } if (badGroups.size() > 0) { throw new OperationFailedException(DomainControllerLogger.ROOT_LOGGER.cannotRemoveDeploymentInUse(deploymentName, badGroups)); } } }
protected void checkCanRemove(OperationContext context, ModelNode operation) throws OperationFailedException { final String deploymentName = PathAddress.pathAddress(operation.require(OP_ADDR)).getLastElement().getValue(); final Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS); if(root.hasChild(PathElement.pathElement(SERVER_GROUP))) { final List<String> badGroups = new ArrayList<String>(); for(final Resource.ResourceEntry entry : root.getChildren(SERVER_GROUP)) { if(entry.hasChild(PathElement.pathElement(DEPLOYMENT, deploymentName))) { badGroups.add(entry.getName()); } } if (badGroups.size() > 0) { throw new OperationFailedException(DomainControllerLogger.ROOT_LOGGER.cannotRemoveDeploymentInUse(deploymentName, badGroups)); } } }
private boolean ignoreExtension(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final String name) { //Should these be the subsystems on the master, as we have it at present, or the ones from the slave? Map<String, SubsystemInformation> subsystems = extensionRegistry.getAvailableSubsystems(name); for (String subsystem : subsystems.keySet()) { for (ResourceEntry profileEntry : domainResource.getChildren(PROFILE)) { if (profileEntry.hasChild(PathElement.pathElement(SUBSYSTEM, subsystem))) { if (!ignoreProfile(domainResource, serverConfigs, profileEntry.getName())) { return false; } } } } return true; }
private boolean ignoreExtension(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final String name) { //Should these be the subsystems on the master, as we have it at present, or the ones from the slave? Map<String, SubsystemInformation> subsystems = extensionRegistry.getAvailableSubsystems(name); for (String subsystem : subsystems.keySet()) { for (ResourceEntry profileEntry : domainResource.getChildren(PROFILE)) { if (profileEntry.hasChild(PathElement.pathElement(SUBSYSTEM, subsystem))) { if (!ignoreProfile(domainResource, serverConfigs, profileEntry.getName())) { return false; } } } } return true; }