コード例 #1
0
  @Override
  public boolean loadString(String s) {

    try {
      // NDLLIBCommon.logger().debug("About to parse manifest");

      // parse as manifest
      NdlManifestParser nmp = new NdlManifestParser(s, this);

      nmp.processManifest();
      // nmp.freeModel();
      // manifest.setManifestTerm(creationTime, expirationTime);

    } catch (Exception e) {
      // NDLLIBCommon.logger().debug("Excpetion: parsing request part of manifest" + e);
      return false;
    }

    // return false if this is not a manifest
    return isManifest;
  }
コード例 #2
0
  // parse first as request
  // then as manifest
  // is request parsing necessary?
  @Deprecated
  public boolean loadGraph(File f) {
    BufferedReader bin = null;
    try {
      FileInputStream is = new FileInputStream(f);
      bin = new BufferedReader(new InputStreamReader(is, "UTF-8"));

      StringBuilder sb = new StringBuilder();
      String line = null;
      while ((line = bin.readLine()) != null) {
        sb.append(line);
        // re-add line separator
        sb.append(System.getProperty("line.separator"));
      }

      bin.close();

      // parse as request
      NdlRequestParser nrp = new NdlRequestParser(sb.toString(), this);
      // something wrong with request model that is part of manifest
      // some interfaces belong only to nodes, and no connections
      // for now do less strict checking so we can get IP info
      // 07/2012/ib
      nrp.doLessStrictChecking();
      nrp.processRequest();
      nrp.freeModel();

      // parse as manifest
      // requestPhase = false;
      NdlManifestParser nmp = new NdlManifestParser(sb.toString(), this);
      nmp.processManifest();
      nmp.freeModel();

    } catch (Exception e) {
      //// logger.error(e.getMessage());
      return false;
    }

    return true;
  }