Package javax.naming.directory

Examples of javax.naming.directory.SearchResult


      // The search has been executed, so process up to one batch of
      // results.
      List<?> result = null;
      while (result == null && searchEnumeration != null && searchEnumeration.hasMore())
      {
        SearchResult searchResult = (SearchResult) searchEnumeration.next();
        result = getRow(searchResult);
      }

      return result;
    } catch (SizeLimitExceededException e) {
View Full Code Here


    doc.getDocumentElement().appendChild(resultElement);

    Element record = null;
    Element attribute = null;

    SearchResult sr = null;
    NamingEnumeration attrs = null;
    Attribute attr = null;
    String key = null;
    NamingEnumeration values = null;
    String value = null;

    try
    {
      while (results.hasMore())
      {
        sr = (SearchResult) results.next();
        attrs = sr.getAttributes().getAll();

        record = doc.createElement("Record");

        while (attrs.hasMore())
        {
View Full Code Here

    {
      ldapResult = executeLdap(binding, context);

      while (ldapResult.hasMore())
      {
        SearchResult sr = ldapResult.next();
        Attributes sra = sr.getAttributes();
       
        Map<String, Node> aBinding = new HashMap<String, Node>();

        // Mapping results to rdf
        if (subject.isVariable())
          aBinding.put(subject.getName(), createLdapNode(sr
              .getNameInNamespace()));

        boolean valid = true;

        for (Triple triple : query)
View Full Code Here

    if ("".equals(queryString)) // We aren't searching, just get attributes
    {
      Attributes attrs = context.getAttributes(baseURI, (String[]) toGet
          .toArray(new String[] {}));
      // Wrap this to fit this method's contract
      SearchResult sr = new SearchResult(null, null, attrs);
      sr.setNameInNamespace(uriToName(baseURI));
      results = new SingletonNamingEnumeration<SearchResult>(sr);
    }
    else // An actual query
    {
      SearchControls sc = new SearchControls();
View Full Code Here

   
    assertTrue("I found Paul", results.hasMore());
   
    while (results.hasMore())
    {
      SearchResult result = results.next();
      Attributes attributes = result.getAttributes();
      NamingEnumeration<? extends Attribute> theAttributes = attributes.getAll();
      while (theAttributes.hasMore())
      {
        Attribute attribute = theAttributes.next();
        log.info("Attribute: " + attribute.getID());
View Full Code Here

       
    NamingEnumeration<SearchResult> results = map.executeLdap(new BindingRoot(), null);
   
    assertTrue("I got a result", results.hasMore());
   
    SearchResult result = results.next();
   
    log.info("Result: " + result.getNameInNamespace());
   
    assertEquals("Paul's email address is right", "paul.shabajee@hp.com", result.getAttributes().get("uid").get(0));
   
    results.close();
   
    Iterator<Map <String, Node>> res = map.execute(new BindingRoot(), null);
   
View Full Code Here

        }
    }

    private void mapResults(PagedResultMapper mapper, NamingEnumeration<SearchResult> results) throws NamingException {
        while (results != null && results.hasMore()) {
            SearchResult searchResult = results.next();
            String dn = searchResult.getNameInNamespace();
           
            try {
                if (isDnValid(dn)) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Included result " + dn);
View Full Code Here

        try {
            SearchControls sctrl = new SearchControls();
            String filter = "(&(objectclass=organizationalUnit)(ou=*))";                       
            NamingEnumeration enm = ctx.search(baseDN, filter, sctrl);
            while (enm.hasMore()) {
                SearchResult sr = (SearchResult) enm.next();               
                config.setCategory(sr.getName());               
            }

        } catch (Exception e) {  
          ErrorReporter.getErrorHandler().reportError(e.getLocalizedMessage(), e);
        }
View Full Code Here

    String userDN = null;
    for (String ldapBase : ldapBases) {
      try {
        NamingEnumeration<SearchResult> enm = ctx.search(ldapBase, filter, ctls);
        while (enm.hasMore()) {
          SearchResult result = enm.next();
          userDN = result.getNameInNamespace();
        }
        if (userDN != null) break;
      } catch (NamingException e) {
        log.error("NamingException when trying to bind user with username::" + uid + " on ldapBase::" + ldapBase, e);
      }
View Full Code Here

    String userDN = null;
    for (String ldapBase : ldapBases) {
      try {
        NamingEnumeration<SearchResult> enm = ctx.search(ldapBase, filter, ctls);
        while (enm.hasMore()) {
          SearchResult result = enm.next();
          userDN = result.getNameInNamespace();
        }
        if (userDN != null) {
          break;
        }
      } catch (NamingException e) {
View Full Code Here

TOP

Related Classes of javax.naming.directory.SearchResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.