public String deploy()

in src/main/java/org/apache/openejb/cts/deploy/StandardDeployment14.java [193:305]


  public String deploy(DeploymentInfo info) throws TSDeploymentException {
    try {
      String sArchive = info.getEarFile();
      // we need to pass the deployinfo to the new porting package to get the
      // plan. For now just use the runtime file
      String[] sRunTimeFileArray = info.getRuntimeFiles();

      TestUtil.logHarness("StandardDeployment14.deploy()");
      sDepNumber = info.getProperty("deployment.props.number");
      initDeployTestUtils(sDepNumber);

      // start distribute here
      TestUtil.logHarness("Starting to distribute:  " + sArchive);

      File earfile = new File(sArchive);
      Object plan = dep2.getDeploymentPlan(info);

      TestUtil.logHarness("file: " + earfile.toString());

      if (plan != null)
        TestUtil.logHarness("plan: " + plan.toString());
      else
        TestUtil.logHarness("No deployment plan for this archive.");

      Target[] targets = dep2.getTargetsToUse(dtu.getTargets(), info);
      if (targets == null || targets.length == 0)
        throw new TSDeploymentException("Empty Target List: ");

      OperationStatus status;

      if (plan instanceof InputStream) {
        // distribute the module
        status = dtu.distributeModuleStreams(targets,
            new FileInputStream(earfile), (InputStream) plan);
      } else if ((plan instanceof File) || (plan == null)) {
        // distribute the module
        status = dtu.distributeModuleFiles(targets, earfile, (File) plan);
      } else {
        throw new TSDeploymentException(
            "Object returned from getDeploymentPlan must return either an InputStream or a File."
                + "  May also be null in some cases like connectors.");
      }

      if (status.isFailed()) {
        throw new TSDeploymentException(
            "Distribute to one or more targets failed " + status.errMessage());
      }

      TestUtil.logHarness(
          "$$$$$$$$$$ Deployment SUCCEEDED for \"" + earfile + "\"");

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

      status = dtu.startModule(status.getDeployedTargetIDs());
      if (status.isFailed()) {
        throw new TSDeploymentException(
            "Starting of module failed on 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.postStart(status.getProgressObject());

      // keep track of filename to TargetmoduleIDs mapping
      htDeployedModules.put(getAppName(sArchive),
          status.getDeployedTargetIDs());

      // Check to see if we're in a test directory that contains
      // embedded rars
      if (sArchive.indexOf("connector" + File.separator + "deployment"
          + File.separator + "ejb_Deployment.ear") != -1) {

        Properties p = new Properties();
        p.setProperty("rar_file", sArchive);
        dep2.createConnectionFactory(status.getDeployedTargetIDs(), p);
      }

      if (sArchive.indexOf("xa" + File.separator + "ee" + File.separator + "tsr"
          + File.separator + "ejb_Tsr.ear") != -1) {

        Properties p = new Properties();
        p.setProperty("rar_file", sArchive);
        dep2.createConnectionFactory(status.getDeployedTargetIDs(), p);
      }

      // if we have a rar file embedded in the ear, then we need to create
      // connection factories - needsome naming we can rely on - don't want
      // to open every ear file to check
      String javaeeLevel = propMgr.getProperty("javaee.level", "full");

      if (javaeeLevel.contains("full") && !sArchive.endsWith(".rar")) {
        return dep2.getClientClassPath(status.getDeployedTargetIDs(), info,
            dtu.getDeploymentManager());
      } else {
        return "";
      }
    } catch (Exception e) {
      e.printStackTrace();

      // just print the details of the failure but don't interrupt the tests
      // leave the test eventually fail if deployment is not available
      // some tests like in WebSocket are explicitly testing deployment failures

//      throw (TSDeploymentException) new TSDeploymentException(
//          "Deployment Failed.").initCause(e);
      return "";
    }
  }