Examples of PagedResultsResponseControl


Examples of javax.naming.ldap.PagedResultsResponseControl

                    byte[] cookie = null;
                    Control[] controls = ctx.getResponseControls();
                    if (controls != null) {
                        for (Control control : controls) {
                            if (control instanceof PagedResultsResponseControl) {
                                PagedResultsResponseControl pagedResult = (PagedResultsResponseControl) control;
                                cookie = pagedResult.getCookie();
                            }
                        }
                    }
                    //continually parsing pages of results until we're done.
                    while ((groupQueryResultCount <= LDAP_GROUP_QUERY_LIMIT) && (cookie != null)) {
                        //ensure the next requests contains the session/cookie details
                        ctx.setRequestControls(new Control[] { new PagedResultsControl(defaultPageSize, cookie,
                            Control.CRITICAL) });
                        executeGroupSearch(filter, groupDetailsMap, ctx, searchControls, baseDNs, x);

                        //update Query state after each page
                        groupQueryResultCount = groupDetailsMap.size();
                        groupQueryPageCount++;
                        groupQueryCurrentTime = System.currentTimeMillis();

                        //empty out cookie
                        cookie = null;
                        //insert group query throttle.
                            //test for further iterations
                            controls = ctx.getResponseControls();
                            if (controls != null) {
                                for (Control control : controls) {
                                    if (control instanceof PagedResultsResponseControl) {
                                        PagedResultsResponseControl pagedResult = (PagedResultsResponseControl) control;
                                        cookie = pagedResult.getCookie();
                                    }
                                }
                            }
                    }
                }
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

          byte[] cookie = null;
          Control[] controls = ctx.getResponseControls();
          if (controls != null) {
            for (Control control : controls) {
              if (control instanceof PagedResultsResponseControl) {
                PagedResultsResponseControl pagedResult = (PagedResultsResponseControl) control;
                cookie = pagedResult.getCookie();
              }
            }
          }

          while (cookie != null) {
            String msg = "RFC 2696 is supported by the server and we are paging through the results. "+
                groupDetailsMap.size()+" results returned so far.";
            if(enableVerboseGroupParsing.isSelected()){
              log(advdb
                  + msg);
            }
            // ensure the next requests contains the session/cookie
            // details
            ctx.setRequestControls(new Control[] { new PagedResultsControl(
                defaultPageSize, cookie, Control.CRITICAL) });
            executeGroupSearch(filter, groupDetailsMap, ctx,
                searchControls, baseDNs, x);
            // empty out cookie
            cookie = null;
            // test for further iterations
            controls = ctx.getResponseControls();
            if (controls != null) {
              for (Control control : controls) {
                if (control instanceof PagedResultsResponseControl) {
                  PagedResultsResponseControl pagedResult = (PagedResultsResponseControl) control;
                  cookie = pagedResult.getCookie();
                }
              }
            }
          }
        }
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

                // Examine the paged results control response
                Control[] controls = ctx.getResponseControls();
                if (controls != null) {
                    for (Control control : controls) {
                        if (control instanceof PagedResultsResponseControl) {
                            PagedResultsResponseControl prrc = (PagedResultsResponseControl) control;
                            cookie = prrc.getCookie();
                        }
                    }
                }
                // Close the enumeration.
                answer.close();
                // Re-activate paged results; affects nothing if no paging support
                List<Control> tmpRequestControls = new ArrayList<Control>();
                if (pageSize > 0) {
                    // Server side paging.
                    tmpRequestControls.add(new PagedResultsControl(pageSize, cookie, Control.CRITICAL));
                }
                Control[] requestControls = tmpRequestControls.toArray(new Control[tmpRequestControls.size()]);
                ctx.setRequestControls(requestControls);
            } while (cookie != null);

            // Add groups found in alternate DN
            if (alternateBaseDN != null) {
                ctx2 = getContext(alternateBaseDN);
                ctx2.setRequestControls(baseRequestControls);

                // Run through all pages of results (one page is also possible  ;)  )
                do {
                    cookie = null;
                    NamingEnumeration<SearchResult> answer = ctx2.search("", searchFilter, searchControls);

                    // Examine all of the results on this page
                    while (answer.hasMoreElements()) {
                        answer.next();
                        count++;
                    }
                    // Examine the paged results control response
                    Control[] controls = ctx2.getResponseControls();
                    if (controls != null) {
                        for (Control control : controls) {
                            if (control instanceof PagedResultsResponseControl) {
                                PagedResultsResponseControl prrc = (PagedResultsResponseControl) control;
                                cookie = prrc.getCookie();
                            }
                        }
                    }
                    // Close the enumeration.
                    answer.close();
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

            }

            // Now read the next ones
            javax.naming.ldap.Control[] responseControls = ((LdapContext)ctx).getResponseControls();
           
            PagedResultsResponseControl responseControl =
                (PagedResultsResponseControl)responseControls[0];
            assertEquals( 0, responseControl.getResultSize() );
           
            // check if this is over
            byte[] cookie = responseControl.getCookie();
           
            if ( StringTools.isEmpty( cookie ) )
            {
                // If so, exit the loop
                break;
            }
           
            // Prepare the next iteration
            createNextSearchControls( ctx, responseControl.getCookie(), pagedSizeLimit );
        }
       
        assertEquals( expectedException, hasSizeLimitException );
        assertEquals( expectedLoop, loop );
        checkResults( results, expectedNbEntries );
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

            }

            // Now read the next ones
            javax.naming.ldap.Control[] responseControls = ((LdapContext)ctx).getResponseControls();
           
            PagedResultsResponseControl responseControl =
                (PagedResultsResponseControl)responseControls[0];
            assertEquals( 0, responseControl.getResultSize() );
           
            // check if this is over
            byte[] cookie = responseControl.getCookie();
           
            if ( StringTools.isEmpty( cookie ) )
            {
                // If so, exit the loop
                break;
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

            }

            // Now read the next ones
            javax.naming.ldap.Control[] responseControls = ((LdapContext)ctx).getResponseControls();
           
            PagedResultsResponseControl responseControl =
                (PagedResultsResponseControl)responseControls[0];
            assertEquals( 0, responseControl.getResultSize() );
           
            // check if this is over
            byte[] cookie = responseControl.getCookie();
           
            if ( StringTools.isEmpty( cookie ) )
            {
                // If so, exit the loop
                break;
            }
           
            // Prepare the next iteration, sending a bad cookie
            createNextSearchControls( ctx, responseControl.getCookie(), 4-loop );
           
            assertEquals( expectedSize[loop-1], results.size() );
        }
       
        assertEquals( 4, loop );
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

        byte[] cookie = null;
        if (responseControls != null) {
            for (int i = 0; i < responseControls.length; i++) {
                if (responseControls[i] instanceof PagedResultsResponseControl) {
                    PagedResultsResponseControl prrc = (PagedResultsResponseControl) responseControls[i];
                    cookie = prrc.getCookie();
                }
            }
        }

        if (cookie == null) {
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

        byte[] cookie = null;
        if (responseControls != null) {
            for (Control responseControl : responseControls) {
                if (responseControl instanceof PagedResultsResponseControl) {
                    PagedResultsResponseControl prrc = (PagedResultsResponseControl) responseControl;
                    cookie = prrc.getCookie();
                }
            }
        }

        if (cookie == null) {
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

        byte[] cookie = null;
        if (responseControls != null) {
            for (Control responseControl : responseControls) {
                if (responseControl instanceof PagedResultsResponseControl) {
                    PagedResultsResponseControl prrc = (PagedResultsResponseControl) responseControl;
                    cookie = prrc.getCookie();
                }
            }
        }

        if (cookie == null) {
View Full Code Here

Examples of javax.naming.ldap.PagedResultsResponseControl

                if ( PagedResultsResponseControl.OID.equals( control.getOid() ) )
                {
                    // Special case for the PagedResultsResponseControl
                    try
                    {
                        convertedControl = new PagedResultsResponseControl( wrapped.getOid(), wrapped.isCritical(),
                            wrapped.getValue() );
                    }
                    catch ( IOException e )
                    {
                        convertedControl = new BasicControl( wrapped.getOid(), wrapped.isCritical(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.