/**
   * reads the configuration file and returns a <code>FilterPipeInfo</code> object.
   *
   * @throws Exception if anything goes wrong while reading the configuration file.
   */
  public static FilterPipeInfo read(String fName, Map servers) throws Exception {

    Reader r = new FileReader(fName);
    FilterPipeInfo pipe = (FilterPipeInfo) (xs.fromXML(r));

    pipe.name = getName(fName);
    int l = pipe.dfas.size();
    pipe.request = new PipelineRequest[l];
    for (int i = 0; i < l; i++) {
      // System.out.println("looking up `"+ pipe.dfas.get(i)+"'");
      FilterSvrInfo svr = (FilterSvrInfo) servers.get(pipe.dfas.get(i));
      if (svr == null) {
        pipe.e = new IOException("no information for server `" + pipe.dfas.get(i) + "' available");
        return pipe;
      }
      if (svr.e != null) {
        Exception e =
            new IOException(
                "referenced server configuration for server `" + svr.name + "' is broken");
        e.initCause(svr.e);
        pipe.e = e;
        return pipe;
      }
      pipe.request[i] = svr.getRequest();
    }
    return pipe;
  }
  /** testing only. */
  public static void main(String[] argv) throws Exception {
    Map servers = FilterSvrInfo.readAll(argv[0]);
    // System.out.println(servers);
    Map pipes = readAll(argv[0], servers);

    Iterator ii = pipes.keySet().iterator();
    while (ii.hasNext()) {
      Object key = ii.next();
      FilterPipeInfo value = (FilterPipeInfo) pipes.get(key);
      value.write(new OutputStreamWriter(System.out));
      System.out.println();
    }
  }