Package netscape.ldap

Examples of netscape.ldap.LDAPSearchResults


                " may be the connect method was not called");
         }
     
         if(logger != null){logger.debug5("search : base = "+base+" filter = " + filter);}
        
         LDAPSearchResults res = connection.search(   base
            ,this.getScope() // SCOPE_BASE, SCOPE_ONE oder SCOPE_SUB                         
            , filter
            , attrs
            ,this.getSearchOnlyAttributes());
       
      /*
       *  Verwendung von SORT
       */
      /*
      String[]  sortAttrs = {"sn", "cn"};
      boolean[] ascending = {true, true};
      res.sort( new LDAPCompareAttrNames(sortAttrs, ascending) );
      */
       
       
      // alle entries lesen
      while (res.hasMoreElements()) {
          try {
              // The next entry
          LDAPEntry entry = res.next();
          entries.add(entry);
           
        }
          catch (LDAPReferralException e) {
              // Ignore any referrals
View Full Code Here


      Integer.decode(hr.get("limit","1000")));
      } catch (Exception e) {
    System.out.println("Ldap error: " + e);
      }
     
      LDAPSearchResults results = ld.search(base, scope, search, attrs,
        false);
      for (i = 0; results.hasMoreElements(); i++) {
    shove(hr.request.props, name + i + ".", results.next(), attrs);
    sb.append(i).append(' ');
      }

      ld.disconnect();
  } catch (LDAPException e) {
View Full Code Here

                 * ld.setOption(LDAPv2.SIZELIMIT,
                 * Integer.decode(hr.get("limit","1000")));
                 * } catch (Exception e) {}
                 */
                StringBuffer sb = new StringBuffer();
                LDAPSearchResults results = ld.search(base, scope, search,
                                                      attrs, false);

                for (int i = 0; results.hasMoreElements(); i++) {
                    sb.append(i).append(' ');
                    shove(hr.request.props, name + i + ".", results.next(),
                          attrs);
                }

                hr.request.props.put(name + "rows", sb.toString().trim());
            } else if (hr.get("modattr") != null) {
View Full Code Here

        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "", new String[]
                { "vendorName" }, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
View Full Code Here

        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "", new String[]
                { "vendorName" }, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
View Full Code Here

        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "", new String[]
                { "vendorName" }, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
View Full Code Here

        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", getLdapServer().getPort(), "", new String[]
                { "vendorName" }, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
View Full Code Here

    private void dump(final LDAPConnection connection, final LDAPWriter writer)
        throws MojoExecutionException
    {
        try
        {
            final LDAPSearchResults results = connection.search(
                this.searchBase, LDAPv2.SCOPE_SUB, this.searchFilter, null,
                false);
            while (results.hasMoreElements())
            {
                final LDAPEntry entry = results.next();
                this.getLog().info("Dumping: " + entry.getDN());
                writer.printEntry(entry);
            }
        }
        catch (LDAPException e)
View Full Code Here

        try
        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", ldapServer.getPort(), "ou=system", new String[]{"vendorName"}, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            fail();
        }
        catch ( LDAPException e )
        {
View Full Code Here

        try
        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", ldapServer.getPort(), "", new String[]{"vendorName"}, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            if ( results.hasMoreElements() )
            {
                LDAPEntry entry = results.next();

                LDAPAttribute vendorName = entry.getAttribute( "vendorName" );

                if ( vendorName != null )
                {
                    assertEquals( "Apache Software Foundation", vendorName.getStringValueArray()[0] );
                }
                else
                {
                    fail();
                }
            }
            else
            {
                fail();
            }
        }
        catch ( LDAPException e )
        {
            fail( "Should not have caught exception." );
        }

        // Check that we cannot read another entry being anonymous
        try
        {
            // Use the netscape API as JNDI cannot be used to do a search without
            // first binding.
            LDAPUrl url = new LDAPUrl( "localhost", ldapServer.getPort(),
                "uid=admin,ou=system", attrIDs, 0, "(ObjectClass=*)" );
            LDAPSearchResults results = LDAPConnection.search( url );

            fail();
        }
        catch ( LDAPException e )
        {
View Full Code Here

TOP

Related Classes of netscape.ldap.LDAPSearchResults

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.