示例#1
0
  /**
   * Executes the ldap search operation.
   *
   * @param config Ldap configuration.
   * @param filter Ldap filter to search on.
   * @param attrs Ldap attributes to return.
   * @throws Exception On errors.
   */
  protected void search(final LdapConfig config, final String filter, final String[] attrs)
      throws Exception {
    final Ldap ldap = new Ldap();
    ldap.setLdapConfig(config);

    try {
      Iterator<SearchResult> results = null;
      if (attrs == null || attrs.length == 0) {
        results = ldap.search(new SearchFilter(filter));
      } else {
        results = ldap.search(new SearchFilter(filter), attrs);
      }
      if (this.outputDsmlv1) {
        (new Dsmlv1()).outputDsml(results, new BufferedWriter(new OutputStreamWriter(System.out)));
      } else if (this.outputDsmlv2) {
        (new Dsmlv2()).outputDsml(results, new BufferedWriter(new OutputStreamWriter(System.out)));
      } else {
        (new Ldif()).outputLdif(results, new BufferedWriter(new OutputStreamWriter(System.out)));
      }
    } finally {
      if (ldap != null) {
        ldap.close();
      }
    }
  }
 public void searchUser(String sAlstomID) {
   _ldap.searchUser(sAlstomID);
 }
 public boolean setAttribute(
     String sEntry, String sAttributeName, Object sAttributeValue, boolean bReplaceValue) {
   return _ldap.setAttribute(sEntry, sAttributeName, sAttributeValue, bReplaceValue);
 }
 public boolean removeAttribute(String sEntry, String sAttributeName, String sAttributeValue) {
   return _ldap.removeAttribute(sEntry, sAttributeName, sAttributeValue);
 }