Package netscape.ldap

Examples of netscape.ldap.LDAPAttribute


        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 produce( LDAPEntry entry )
  throws SAXException
    {
  AttributeListImpl attrList;
  LDAPAttributeSet  attrSet;
  LDAPAttribute     attr;
  Enumeration       enumeration;
  Enumeration       values;
  byte[]            value;

  leaveSchema();
  enterDirectory();

  // dsml:entry dn
  attrList = new AttributeListImpl();
  attrList.addAttribute( XML.Entries.Attributes.DN, "CDATA", entry.getDN() );
  // dsml:entry
  _docHandler.startElement( prefix( XML.Entries.Elements.Entry ), attrList );
 
  attrSet = entry.getAttributeSet();
  if ( attrSet != null ) {
     
      attr = attrSet.getAttribute( "objectclass" );
      if ( attr != null ) {
    // dsml:objectclass
    attrList = new AttributeListImpl();
    _docHandler.startElement( prefix( XML.Entries.Elements.ObjectClass ), attrList );
    values = attr.getStringValues();
    while ( values.hasMoreElements() ) {
        char[] chars;
       
        // dsml:oc-value
        chars = ( (String) values.nextElement() ).toCharArray();
        attrList = new AttributeListImpl();
        _docHandler.startElement( prefix( XML.Entries.Elements.OCValue ), attrList );
        _docHandler.characters( chars, 0, chars.length );
        _docHandler.endElement( prefix( XML.Entries.Elements.OCValue ) );
    }
    _docHandler.endElement( prefix( XML.Entries.Elements.ObjectClass ) );
      }
     
      enumeration = attrSet.getAttributes();
      while ( enumeration.hasMoreElements() ) {
    // dsml:attr
    attr = (LDAPAttribute) enumeration.nextElement();
    if ( attr.getName().equals( "objectclass" ) )
        continue;
    attrList = new AttributeListImpl();
    attrList.addAttribute( XML.Entries.Attributes.Name, "CDATA", attr.getName() );
    _docHandler.startElement( prefix( XML.Entries.Elements.Attribute ), attrList );
   
    values = attr.getByteValues();
    while ( values.hasMoreElements() ) {
        char[] chars;
        int    i;

        // dsml:value
View Full Code Here

  throws LDAPException
    {
  LDAPEntry           existing;
  LDAPModificationSet modifs;
  LDAPAttributeSet    attrSet;
  LDAPAttribute       attr;
  int                 i;
  Enumeration         enumeration;

  if ( entry.getAttributeSet() == null ||
       entry.getAttributeSet().size() == 0 ) {

      if ( ( policy & ImportDescriptor.Policy.DeleteEmpty ) != 0 ) {
    try {
        _conn.read( entry.getDN() );
        _conn.delete( entry.getDN() );
        notify( entry.getDN(), ImportEventListener.Deleted );
    } catch ( LDAPException except ) {
        // Object does not exist, was not removed, ignore.
        // Anything else, we must complain.
        if ( except.getLDAPResultCode() != LDAPException.NO_SUCH_OBJECT )
      throw except;
        notify( entry.getDN(), ImportEventListener.Ignored );
    }
      } else {
    notify( entry.getDN(), ImportEventListener.Ignored );
      }

  } else {

      try {
    existing = _conn.read( entry.getDN() );

    modifs = new LDAPModificationSet();
    attrSet = entry.getAttributeSet();
    for ( i = 0 ; i < attrSet.size() ; ++i ) {
                    attr = attrSet.elementAt( i );
                    if ( existing.getAttributeSet().getAttribute( attr.getName() ) != null ) {
                        if ( ( policy & ImportDescriptor.Policy.NewAttrOnly ) == 0 ) {
                            if ( attr.size() > 0 ) {
                                modifs.add( LDAPModification.REPLACE, attr );
                            } else {
                                modifs.add( LDAPModification.DELETE, attr );
                            }
                        }
                    } else {
                        if ( ( policy & ImportDescriptor.Policy.UpdateOnly ) == 0 ) {
                            if ( attr.size() > 0 ) {
                                modifs.add( LDAPModification.ADD, attr );
                            }
                        }
                    }
                }
                if ( ( policy & ImportDescriptor.Policy.ReplaceAttr ) != 0 ) {
        enumeration = existing.getAttributeSet().getAttributes();
        while ( enumeration.hasMoreElements() ) {
      attr = (LDAPAttribute) enumeration.nextElement();
      if ( entry.getAttribute( attr.getName() ) == null ) {
          modifs.add( LDAPModification.DELETE, attr );
      }
        }
    }
    if ( modifs.size() > 0 ) {
View Full Code Here

      _attrSet = new LDAPAttributeSet();
      _entryDN = attr.getValue( XML.Entries.Attributes.DN );
  } else if ( tagName.equals( XML.Entries.Elements.ObjectClass ) ) {
      if ( _attrSet == null || _attr != null )
    throw new SAXException( Messages.format( "dsml.openingTagNotRecognized", tagName ) );
      _attr = new LDAPAttribute( "objectclass" );
  } else if ( tagName.equals( XML.Entries.Elements.Attribute ) ) {
      if ( _attrSet == null || _attr != null )
    throw new SAXException( Messages.format( "dsml.openingTagNotRecognized", tagName ) );
      _attr = new LDAPAttribute( attr.getValue( XML.Entries.Attributes.Name ) );
  } else if ( tagName.equals( XML.Entries.Elements.Value ) ||
        tagName.equals( XML.Entries.Elements.OCValue ) ) {
      if ( _attrSet == null || _attr == null || _value != null )
    throw new SAXException( Messages.format( "dsml.openingTagNotRecognized", tagName ) );
      if ( XML.Entries.Attributes.Encodings.Base64.equals(
View Full Code Here

           else
             write("\n");
            String dn = "dn: " + entry.getDN();
            write(dn);
            while (attrs.hasMoreElements()) {
                LDAPAttribute attr = (LDAPAttribute) attrs.nextElement();
                String name = attr.getName();
                Enumeration values = attr.getStringValues();
                while (values.hasMoreElements()) {
                    String attribute = name + ": " + values.nextElement();
                    write(attribute);
                }
            }
View Full Code Here

    return null;
   
    LDAPUsuario usuario = new LDAPUsuario();   
    for ( int i = 0; i < filtros.length; i++){
     
         LDAPAttribute attr = entry.getAttribute(filtros[i]);
         if(attr != null){
          
           Enumeration enumVals = attr.getStringValues();
           while((enumVals != null) && enumVals.hasMoreElements()){
            
             String val = (String)enumVals.nextElement();
             switch(i){
               case 0 :{                            
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.