Package netscape.ldap

Examples of netscape.ldap.LDAPAttribute


            connection.bind(_authid, _authpw );
         
          //change attribut         
            connection.modify( base,
              new LDAPModification(LDAPModification.REPLACE,
                  new LDAPAttribute( attrKey, value)));
          return true;
        } catch( LDAPException e1) {
          throw new Exception ("..can not change the Key. " + attrKey + "=" + value + " " + e1.toString());                  
        }
       
View Full Code Here


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

                        Enumeration enumAttrs = set.getAttributes();
                        while ( enumAttrs.hasMoreElements() ) {
                            LDAPAttribute anAttr = (LDAPAttribute)enumAttrs.nextElement();
                            String attrName = anAttr.getName();
                  
                            System.out.print( attrName );
                  
                            Enumeration enumVals = anAttr.getStringValues();
                  
                            if(enumVals != null){
                                while ( enumVals.hasMoreElements() ) {
                                    String aVal = ( String )enumVals.nextElement();
                                    System.out.println( "\t" + aVal );
View Full Code Here

    {
  props.put(prefix + "dn", entry.getDN());
  if (names == null) {
      Enumeration e = entry.getAttributeSet().getAttributes();
      while (e.hasMoreElements()) {
    LDAPAttribute attr = (LDAPAttribute) e.nextElement();
    props.put(prefix + attr.getName(), getAttributeValue(attr));
      }
  } else {
      for (int i = 0; i < names.length; i++) {
    LDAPAttribute attr = entry.getAttribute(names[i]);
    String value = (attr == null) ? "" : getAttributeValue(attr);
    props.put(prefix + names[i], value);
      }
  }
    }
View Full Code Here

                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...
View Full Code Here

     *
     * @see
     */
    public void addattrs(String s, Object attrs, String actions[]) {
        StringTokenizer st = new StringTokenizer(s, "|");
    LDAPAttribute attr = null;
    int index = 0;

        while (st.hasMoreTokens()) {
            StringTokenizer ts = new StringTokenizer(st.nextToken(), "=,");

            attr = new LDAPAttribute(ts.nextToken());

            while (ts.hasMoreTokens()) {
                attr.addValue(ts.nextToken());
            }

            System.out.println("Add:" + attr);

            if (attrs instanceof LDAPModificationSet) {
View Full Code Here

        if (names == null) {
            Enumeration e = entry.getAttributeSet().getAttributes();

            while (e.hasMoreElements()) {
                LDAPAttribute attr = (LDAPAttribute) e.nextElement();

                props.put(prefix + attr.getName(), getAttributeValue(attr));
            }
        } else {
            for (int i = 0; i < names.length; i++) {
                LDAPAttribute attr = entry.getAttribute(names[i]);
                String value = (attr == null) ? "" : getAttributeValue(attr);

                props.put(prefix + names[i], value);
            }
        }
View Full Code Here

        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, new byte[0] ) );
        conn.setConstraints( constraints );
       
        // 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 );
View Full Code Here

        LDAPConstraints constraints = new LDAPConstraints();
        conn.setConstraints( constraints );

        // referrals failure
        LDAPAttributeSet attrSet = new LDAPAttributeSet();
        attrSet.add( new LDAPAttribute( "objectClass", "organizationalUnit" ) );
        attrSet.add( new LDAPAttribute( "ou", "UnderReferral" ) );
        LDAPEntry entry = new LDAPEntry( "ou=UnderReferral,ou=Computers,uid=akarasuluref,ou=users,ou=system", attrSet );
       
        LDAPResponseListener listener = conn.add( entry, null, constraints );
        LDAPResponse response = listener.getResponse();
        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
View Full Code Here

        conn.setConstraints( constraints );
       
        // referrals failure

        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 );
       
        LDAPResponseListener listener = null;
        LDAPResponse response = null;
        listener = conn.add( entry, null, constraints );
View Full Code Here

    public void testIllegalModification2() throws Exception
    {
        LDAPConnection con = getWiredConnection( ldapServer );

        // first a valid attribute
        LDAPAttribute attr = new LDAPAttribute( "description", "The description" );
        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attr );
        // then an invalid one without any value
        attr = new LDAPAttribute( "displayName" );
        LDAPModification mod2 = new LDAPModification( LDAPModification.ADD, attr );

        try
        {
            con.modify( "cn=Kate Bush,ou=system", new LDAPModification[] { mod, mod2 } );
View Full Code Here

TOP

Related Classes of netscape.ldap.LDAPAttribute

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.