Examples of LDAPAttribute


Examples of netscape.ldap.LDAPAttribute

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

        // modify success
        LDAPAttribute attribute = new LDAPAttribute( "description", "referral to akarasulu" );
        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
        conn.modify( "uid=akarasuluref,ou=users,ou=system", mod, constraints );

        assertTrue( conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, constraints ) );
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

        constraints.setReferrals( false );
        conn.setConstraints( constraints );

        // referrals failure
        // modify success
        LDAPAttribute attribute = new LDAPAttribute( "description", "referral to akarasulu" );
        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
        LDAPResponseListener listener = conn.modify( "uid=akarasuluref,ou=users,ou=system", mod, null, constraints );
        LDAPResponse response = listener.getResponse();

        assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

        LDAPConnection conn = getNsdkWiredConnection( getLdapServer() );
        LDAPConstraints constraints = new LDAPConstraints();
        conn.setConstraints( constraints );

        // referrals failure
        LDAPAttribute attribute = new LDAPAttribute( "ou", "Machines" );
        LDAPModification mod = new LDAPModification( LDAPModification.ADD, attribute );
        LDAPResponseListener listener = null;
        LDAPResponse response = null;

        listener = conn.modify( "ou=Computers,uid=akarasuluref,ou=users,ou=system", mod, null, constraints );
View Full Code Here

Examples of netscape.ldap.LDAPAttribute

        constraints.setServerControls( new LDAPControl( LDAPControl.MANAGEDSAIT, true, Strings.EMPTY_BYTES ) );
        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

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

Examples of netscape.ldap.LDAPAttribute

        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

Examples of netscape.ldap.LDAPAttribute

      _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

Examples of netscape.ldap.LDAPAttribute

    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

Examples of netscape.ldap.LDAPAttribute

  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

Examples of netscape.ldap.LDAPAttribute

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