Beispiel #1
0
  public void run(String host, String port, String dn) {

    MDS mds = new MDS(host, port);

    try {

      try {
        mds.connect();
      } catch (MDSException e) {
        System.err.println("MDS error:" + e.getMessage() + " " + e.getLdapMessage());
        errorCount++;
        return;
      }

      try {
        mdsResult = mds.getAttributes(dn);
        mdsResult.print();
      } catch (MDSException e) {
        System.err.println("MDS error:" + e.getMessage() + " " + e.getLdapMessage());
        errorCount++;
        return;
      }

      System.out.println("---");

      mds.setSearchLimit(10);
      try {
        v =
            mds.search(
                dn,
                "(objectclass=*)",
                new String[] {"objectclass", "domainname"},
                MDS.ONELEVEL_SCOPE);

        Enumeration e = v.keys();
        while (e.hasMoreElements()) {
          dn = (String) e.nextElement();
          mdsResult = (MDSResult) v.get(dn);
          System.out.println("DN: " + dn);
          System.out.println("...domain: " + mdsResult.getFirstValue("domainname"));
        }
      } catch (MDSException e) {
        System.err.println("MDS error:" + e.getMessage() + " " + e.getLdapMessage());
        errorCount++;
        return;
      }

    } finally {
      try {
        mds.disconnect();
      } catch (MDSException e) {
      }
    }
  }