@Override
 public ServerGroupDeploymentReplaceUpdate getCompensatingUpdate(ServerGroupElement original) {
   ServerGroupDeploymentElement toReplace = original.getDeployment(replacedDeploymentName);
   if (toReplace == null) return null;
   return new ServerGroupDeploymentReplaceUpdate(
       toReplace.getUniqueName(), toReplace.getRuntimeName(), toReplace.getSha1Hash(), uniqueName);
 }
  @Override
  protected void applyUpdate(ServerGroupElement serverGroupElement) throws UpdateFailedException {

    ServerGroupDeploymentElement undeploymentElement =
        serverGroupElement.getDeployment(replacedDeploymentName);

    if (undeploymentElement == null) {
      throw new UpdateFailedException("Unknown deployment " + serverGroupElement);
    }

    // This may also be an add
    serverGroupElement.addDeployment(uniqueName, runtimeName, hash, false);
    ServerGroupDeploymentElement deploymentElement = serverGroupElement.getDeployment(uniqueName);

    undeploymentElement.setStart(false);
    deploymentElement.setStart(true);
  }