Package netscape.ldap

Examples of netscape.ldap.LDAPEntry


       
      // 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


                    System.out.println("LDAP Server hat "+entries.size()+" Eintrag(e) gefunden f�r "+searchParametrs.toString());
               
                    int j=1;
                    for(int i=0;i<entries.size();i++){
                        System.out.println("----Eintrag "+j+"------------------------");
                        LDAPEntry entry = (LDAPEntry)entries.get(i);
                        System.out.println("DN ist : "+entry.getDN());
         
                        LDAPAttributeSet set = entry.getAttributeSet();

                        //System.out.println("attribute 1 = "+set);
                        System.out.println("");

                        Enumeration enumAttrs = set.getAttributes();
View Full Code Here

  try {
      ld.connect(host, LDAPv2.DEFAULT_PORT, auth, password);

      String dn = hr.get("dn");
      if (dn != null) {
    LDAPEntry entry = ld.read(dn, attrs);

    /*
     * Empirically: An entry != null may be returned even if no
     * match was found.
     */
    if ((entry != null) && (entry.getDN() != null)) {
        shove(hr.request.props, name, entry, attrs);
    }
    return;
      }

View Full Code Here

                }

                String[] attrs = split(hr.get("attributes"));

                if (dn != null) {
                    LDAPEntry entry = ld.read(dn, attrs);

                    /*
                    
                     * match was found.
                     */
                    if ((entry != null) && (entry.getDN() != null)) {
                        shove(hr.request.props, name, entry, attrs);
                    }

                    return;
                }

                String search = hr.get("search");

                /*
                 * LDAPSearchConstraints sc = ld.getSearchConstraints();
                 * sc.setMaxResults( 0 );
                 * try {
                 * 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) {
        // Support delete, modify and add an attribute in one operation
        // .. nodattrs="cn|uid=x" actions="d r a"
        String actions[] = split( hr.get("actions") );
        if ( actions == null ){
          return;
        }
              LDAPModificationSet attrs = new LDAPModificationSet();
                addattrs(hr.get("modattr"), attrs, actions);
        System.out.println ( attrs );
              ld.modify( dn, attrs );
            } else if (hr.get("delete") != null) {
                ld.delete(dn);
            } else if (hr.get("add") != null) {
                String add = hr.get("add");

                System.out.println(add);

                LDAPAttributeSet attrs = new LDAPAttributeSet();
                LDAPAttribute attr = new LDAPAttribute("objectclass");

                for (int i = 0; i < objectclass_values.length; i++) {
                    attr.addValue(objectclass_values[i]);
                }

                attrs.add(attr);

                // The add string will look like this: cn=x,y|sn=u,z|x3=p...

                addattrs(add, attrs, null);
        //        attrs.add(new LDAPAttribute("uid", "x1"));

                LDAPEntry myEntry = new LDAPEntry(dn, attrs);

                System.out.println(myEntry);
                ld.add(myEntry);
            }

View Full Code Here

        {
            // expected
        }

        // Check whether entry is unmodified, i.e. no displayName
        LDAPEntry entry = con.read( DN );
        assertEquals( "displayName exists?", null, entry.getAttribute( "displayName" ) );
    }
View Full Code Here

        {
            // expected
        }

        // Check whether entry is unmodified, i.e. no displayName
        LDAPEntry entry = con.read( DN );
        assertEquals( "displayName exists?", null, entry.getAttribute( "displayName" ) );
    }
View Full Code Here

        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, Strings.EMPTY_BYTES ) );
        conn.setConstraints( constraints );

        // ModifyDN success
        conn.rename( "uid=akarasuluref,ou=users,ou=system", "uid=ref", true, constraints );
        LDAPEntry entry = conn.read( "uid=ref,ou=users,ou=system", ( LDAPSearchConstraints ) constraints );
        assertNotNull( entry );
        assertEquals( "uid=ref,ou=users,ou=system", entry.getDN() );

        conn.disconnect();
    }
View Full Code Here

                { "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] );
                }
View Full Code Here

                { "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] );
                }
View Full Code Here

        // add success
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,uid=akarasuluref,ou=users,ou=system", attrSet );

        try
        {
            conn.add( entry, constraints );
            fail();
View Full Code Here

TOP

Related Classes of netscape.ldap.LDAPEntry

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.