天天看點

CORAB 對 ior 檔案的解析使用

 String filename = "ior.txt";

 org.omg.CORBA.Object obj = null;

File file = new File(filename);

String ior_context = readIorFile(filename);

 if (ior_context == null) {

        log.error("解析ior檔案失敗,跳出程式!");

        return -1;

      }

      ior_context = ior_context.trim();

      log.info("-------入口點IOR檔案内容為--------" + ior_context);

      obj = this.orb.string_to_object(ior_context);

}

    EmsSessionFactory_I m_emsFactory = EmsSessionFactory_IHelper.narrow(obj);

-------------------解析完畢 接下來是擷取 POA 擷取emsSession  利用  Common_IHolder 初始化各種管理器

//--------------------------- readIorFile

public String readIorFile(String fileName)

  {

    BufferedReader bufferedreader = null;

    try {

      bufferedreader = new BufferedReader(new InputStreamReader(new FileInputStream(fileName)));

    }

    catch (FileNotFoundException ex) {

      log.error("找不到ior檔案------->" + fileName, ex);

      return null;

    }

    try {

      String s = bufferedreader.readLine();

      return s;

    } catch (IOException ex1) {

      log.error("讀取ior檔案" + fileName + "失敗------->", ex1);

    }return null;

  }