public void undeploy()

in src/main/java/org/apache/openejb/cts/deploy/StandardDeployment14.java [307:361]


  public void undeploy(String moduleId) throws TSDeploymentException {
    ModuleType moduleType = getModuleType(moduleId);
    TargetModuleID[] idsToUndeploy = (TargetModuleID[]) htDeployedModules
        .get(getAppName(moduleId));

    TestUtil.logHarnessDebug(
        "$$$$$$$$$$$$$ idsToUndeploy.length = " + idsToUndeploy.length);
    TestUtil.logHarnessDebug("$$$$$$$$$$$$$ Undeploying Module ID \""
        + idsToUndeploy[0].getModuleID() + "\"");

    if (idsToUndeploy == null) {
      TestUtil.logHarness(
          "idToUndeploy is null.  Assuming that the module is not currently deployed");
      return;
    } else {
      TestUtil.logHarness("Undeploying module \"" + moduleId + "\"");
    }

    OperationStatus status = null;
    try {
      status = dtu.stopModule(idsToUndeploy);
      if (status.isFailed()) {
        // log a message but still try to undeploy all the modules
        TestUtil.logHarness(
            "Stop failed for one or more targets while undeploying module \""
                + moduleId + "\"");
      }

      // Allow the licensee an opportunity to examine the returned
      // ProgressObject and
      // take any vendor specifc actions that may be necessary.
      dep2.postStop(status.getProgressObject());

      status = dtu.undeployModule(idsToUndeploy);
      if (status.isFailed()) {
        TestUtil.logHarness("Undeploy failed for one or more targets \""
            + status.errMessage() + "\"");
      }

      // Allow the licensee an opportunity to examine the returned
      // ProgressObject and
      // take any vendor specifc actions that may be necessary.
      dep2.postUndeploy(status.getProgressObject());

      htDeployedModules.remove(getAppName(moduleId));
    } catch (Exception e) {
      e.printStackTrace();
      throw new TSDeploymentException("Error while undeploying");
    }
    if (status.isFailed()) {
      throw new TSDeploymentException(
          "Undeploy failed for one or more targets \"" + status.errMessage()
              + "\"");
    }
  }