// Add a step to remove the the deployments
if (requiresRuntime(context)) { // only add the step if we are going to actually undeploy the ear
PathAddress deploymentAddress = PathAddress.pathAddress(PathElement.pathElement(DEPLOYMENT,
StartupExtension.DEPLOYMENT_APP_EAR));
ModelNode op = Util.getEmptyOperation(REMOVE, deploymentAddress.toModelNode());
ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration();
OperationStepHandler handler = rootResourceRegistration.getOperationHandler(deploymentAddress, REMOVE);
context.addStep(op, handler, OperationContext.Stage.MODEL);
}
super.performRemove(context, operation, model);
}