public CapArea enviroment() {
   try {
     return capInterface.getArea("Environment");
   } catch (Exception e) {
     CoreTsp.out("Failed to get CapArea[Enviroment]");
     healthy = false;
     return null;
   }
 }
  private CapAreaManager() throws TspRuntimeException {
    try {
      CorbaManager corbaManager = CorbaManager.instance();

      ORB orb = corbaManager.orbInstance();

      String capIOR = getCapIOR();

      org.omg.CORBA.Object capObj = orb.string_to_object(capIOR);

      capInterface = Sapphire.CAP.CapAreaHelper.narrow(capObj);

      CapArea corbaCapArea = capInterface.getArea("CorbaCap");

      Sapphire.CAP.CorbaCapArea corbaCap = Sapphire.CAP.CorbaCapAreaHelper.narrow(corbaCapArea);

      itaInterface = corbaCap.getITA(); // to restore connection after getting TestProgram Interface

      testProgram = capInterface.getArea("TestProgram");

      levelsArea = itaInterface.getArea("Level", "D4064PS");

      healthy = true;

    } catch (Fatal e) {
      e.printStackTrace();
      healthy = false;
    } catch (Basic e) {
      e.printStackTrace();
      healthy = false;
    } catch (org.omg.CORBA.BAD_PARAM e) {
      System.out.println(
          "CORBA COMM Failure Encountered:  This exception "
              + "will happen if Orion is not running.");
      healthy = false;
    }
    if (!healthy) CoreTsp.out("CapAreaManager is NOT healthy.");
    else CoreTsp.out("CapAreaManager is healthy.");
  }
  public void setEnvVars() {
    // Load some test program enviroment variables
    try {
      CapArea env = capInterface.getArea("Environment");

      TSPProperties properties = TSPProperties.instance();
      ProgramInitInfo testProgInit = ProgramInitInfo.instance();

      String tpFullPath = testProgram.getS("Path");

      String[] tpPathEls = tpFullPath.split("\\\\");

      String progName = "";
      String progVersion = ""; // Added as part of IMS changes

      for (int i = tpPathEls.length - 1; i >= 0; i--) {
        CoreTsp.out(tpPathEls[i]);
        if (tpPathEls[i] != null && !tpPathEls[i].equals("")) {
          progName = tpPathEls[i];
          progVersion = tpPathEls[i - 1]; // Added as part of IMS changes
          break;
        }
      }

      // Added as part of IMS changes
      String[] progVersionEls = progVersion.split("_");
      String TpVer = progVersionEls[progVersionEls.length - 1];

      testProgInit.put("TpName", progName);
      testProgInit.put("TpPath", tpFullPath);
      testProgInit.put("TpVersion", TpVer); // Added as part of IMS changes

      properties.put("TPPath", tpFullPath);
      properties.put("Program", progName);
      properties.put("ProgramVersion", TpVer); // Added as part of IMS changes

      // }

      env.setS("VariableName", "XTOS_TSPCLASSPATH");

      if (env.getB("VariableExists")) {
        String tspClassPath = env.getS("VariableValue");
        String tspPath = tspClassPath.split("classes")[0];

        properties.put("TspDir", tspPath);
        properties.put("TspClassPath", tspClassPath);
        healthy = true;
      } else CoreTsp.out("Error: XTOS_TSPCLASSPATH not set");
    } catch (Fatal e) {
      CoreTsp.out("An exception occurred while communicating with XTOS.");
      e.printStackTrace();
      healthy = false;
    } catch (Basic e) {
      e.printStackTrace();
      healthy = false;
    } catch (TspRuntimeException e) {
      CoreTsp.out(
          "An exception occurred while attempting to "
              + "retrieve an instance of the the internal properties data structure.");
    }
  }