Package javax.naming.directory

Examples of javax.naming.directory.BasicAttribute


    {
        LdapContext sysRoot = getSystemContext( service );
        createData( sysRoot );

        //
        Attribute attr = new BasicAttribute( "c" );
        attr.add( "FR" );
        attr.add( "US" );
        Attributes attrs = new BasicAttributes( "c", true );
        attrs.put( attr );

        // Add the AVA
        sysRoot.modifyAttributes( "ou=testing01", DirContext.ADD_ATTRIBUTE, attrs );
View Full Code Here


        }

        // if nis is disabled then enable it
        if ( isNisDisabled )
        {
            Attribute disabled = new BasicAttribute( "m-disabled" );
            ModificationItem[] mods = new ModificationItem[] {
                new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
            schemaRoot.modifyAttributes( "cn=nis", mods );
        }

        // -------------------------------------------------------------------
        // Add a bunch of nis groups
        // -------------------------------------------------------------------
        addNisPosixGroup( "testGroup0", 0 );
        addNisPosixGroup( "testGroup1", 1 );
        addNisPosixGroup( "testGroup2", 2 );
        addNisPosixGroup( "testGroup4", 4 );
        addNisPosixGroup( "testGroup5", 5 );
       
        // Create a test account
        Attributes test = new BasicAttributes( true );
        Attribute oc = new BasicAttribute( "ObjectClass" );
        oc.add( "top" );
        oc.add( "account" );
        oc.add( "posixAccount" );
        test.put( oc );
       
        test.put( "cn", "test" );
        test.put( "uid", "1" );
        test.put( "uidNumber", "1" );
View Full Code Here

        LdapContext sysRoot = getSystemContext( service );
        createData( sysRoot );

        // A new description attribute value
        Attributes attrs = new BasicAttributes( "description", true );
        Attribute descr = new BasicAttribute( "description" );
        descr.add( "an American singer-songwriter" );
        descr.add( "she has blond hair" );
        attrs.put( descr );
       
        sysRoot.modifyAttributes( RDN_KIM_WILDE, DirContext.REMOVE_ATTRIBUTE, attrs );

        // Verify that the attribute value has been removed
View Full Code Here

        }

        // if nis is disabled then enable it
        if ( isNisDisabled )
        {
            Attribute disabled = new BasicAttribute( "m-disabled" );
            ModificationItem[] mods = new ModificationItem[] {
                new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
            schemaRoot.modifyAttributes( "cn=nis", mods );
        }

        // -------------------------------------------------------------------
        // Add a bunch of nis groups
        // -------------------------------------------------------------------
        addNisPosixGroup( "testGroup0", 0 );
        addNisPosixGroup( "testGroup1", 1 );
        addNisPosixGroup( "testGroup2", 2 );
        addNisPosixGroup( "testGroup4", 4 );
        addNisPosixGroup( "testGroup5", 5 );
       
        // Create a test account
        Attributes test = new BasicAttributes( true );
        Attribute oc = new BasicAttribute( "ObjectClass" );
        oc.add( "top" );
        oc.add( "account" );
        oc.add( "posixAccount" );
        test.put( oc );
       
        test.put( "cn", "test" );
        test.put( "uid", "1" );
        test.put( "uidNumber", "1" );
View Full Code Here

        createData( sysRoot );
       
        // Try to delete and add the SN which is in MUST
        ModificationItem[] mods = new ModificationItem[2];
       
        Attribute snOld = new BasicAttribute( "sn", "Amos" );
        mods[0] = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, snOld );
        Attribute snNew = new BasicAttribute( "sn", "TAmos" );
        mods[1] = new ModificationItem( DirContext.ADD_ATTRIBUTE, snNew );

        sysRoot.modifyAttributes( RDN_TORI_AMOS, mods );

        // Verify that the attribute value has been added
        Attributes attrs = sysRoot.getAttributes( RDN_TORI_AMOS );
        Attribute attr = attrs.get( "sn" );
        assertNotNull( attr );
        assertTrue( attr.contains( snNew.get() ) );
        assertEquals( 1, attr.size() );
    }
View Full Code Here

    {
        Attributes[] attributes = new Attributes[count];
        for ( int ii = 0; ii < count; ii++ )
        {
            attributes[ii] = new BasicAttributes( true );
            Attribute oc = new BasicAttribute( "objectClass" );
            oc.add( "top" );
            oc.add( "organizationalUnit" );
            attributes[ii].put( oc );
            Attribute ou = new BasicAttribute( "ou" );
            ou.add( String.valueOf( ii ) );
            ou.add( "testEntry" );
            attributes[ii].put( ou );
            attributes[ii].put( "telephoneNumber", String.valueOf( count ) );
        }

        return attributes;
View Full Code Here

    {
        //--------------------------------------------------------------------
        // The accountStatus AT
        //--------------------------------------------------------------------
        Attributes attributes = new BasicAttributes( true );
        Attribute  objectClassAttribute = new BasicAttribute( "objectClass" );
       
        objectClassAttribute.add( "top" );
        objectClassAttribute.add( "metaTop" );
        objectClassAttribute.add( "metaAttributeType" );
       
        attributes.put( objectClassAttribute );
       
        attributes.put( "m-oid", "2.16.840.1.113730.3.2.22.249" );
       
        // The name
        attributes.put( "m-name", "accountStatus" );
       
        // The Obsolete flag
        attributes.put( "m-obsolete", "FALSE" );
       
        // The single value flag
        attributes.put( "m-singleValue", "TRUE" );
       
        // The collective flag
        attributes.put( "m-collective", "FALSE" );
       
        // The noUserModification flag
        attributes.put( "m-noUserModification", "FALSE" );

        // The usage
        attributes.put( "m-usage", "USER_APPLICATIONS" );
       
        // The equality matching rule
        attributes.put( "m-equality", "caseIgnoreMatch" );
       
        // The substr matching rule
        attributes.put( "m-substr", "caseIgnoreSubstringsMatch" );
       
        // The syntax
        attributes.put( "m-syntax", "1.3.6.1.4.1.1466.115.121.1.15" );

        // The superior
        attributes.put( "m-supAttributeType", "name" );

        // The description
        attributes.put( "m-description", "Account Status" );
       
        // Inject the AT
        DN dn = new DN( "ou=attributeTypes,cn=apachemeta" );
        dn.add( MetaSchemaConstants.M_OID_AT + "=2.16.840.1.113730.3.2.22.249" );
       
        getSchemaContext( service ).createSubcontext( dn, attributes );
       
        //--------------------------------------------------------------------
        // The extendPerson OC
        //--------------------------------------------------------------------
        attributes = new BasicAttributes( true );
         objectClassAttribute = new BasicAttribute( "objectClass" );
       
        objectClassAttribute.add( "top" );
        objectClassAttribute.add( "metaTop" );
        objectClassAttribute.add( "metaObjectClass" );
       
        attributes.put( objectClassAttribute );
       
        attributes.put( "m-oid", "2.16.840.1.113730.3.2.22" );
       
View Full Code Here

        createUser( "billyd", "billyd" );
       
        // create an entry subordinate to the user
        DirContext billydCtx = AutzIntegUtils.getContextAsAdmin("uid=billyd,ou=users,ou=system");
        Attributes phoneBook = new BasicAttributes( "ou", "phoneBook", true );
        Attribute objectClass = new BasicAttribute( "objectClass" );
        phoneBook.put( objectClass );
        objectClass.add( "top" );
        objectClass.add( "organizationalUnit" );
        billydCtx.createSubcontext( "ou=phoneBook", phoneBook );

        // now add a subentry that enables anyone to search below their own entries
        createAccessControlSubentry( "anybodySearchTheirSubordinates", "{ " + "identificationTag \"searchAci\", " + "precedence 14, "
            + "authenticationLevel none, " + "itemOrUserFirst userFirst: { " + "userClasses { allUsers }, "
View Full Code Here

     */
    @Test
    public void testCannotCreateObjectClassWithInvalidNameAttribute() throws Exception
    {
        Attributes attributes = new BasicAttributes( true );
        Attribute  objectClassAttribute = new BasicAttribute( "objectClass" );
       
        objectClassAttribute.add( "top" );
        objectClassAttribute.add( "metaTop" );
        objectClassAttribute.add( "metaObjectClass" );
       
        attributes.put( objectClassAttribute );
       
        attributes.put( "m-oid", "testOID" );
       
View Full Code Here

     */
    @Test
    public void testCannotCreateObjectClassWithNoObjectClass() throws Exception
    {
        Attributes attributes = new BasicAttributes( true );
        Attribute  objectClassAttribute = new BasicAttribute( "objectClass" );
       
        objectClassAttribute.add( "top" );
        objectClassAttribute.add( "metaTop" );
        objectClassAttribute.add( "metaObjectClass" );
       
        // Don't put the objectclasses in the entry : this is on purpose !
        // attributes.put( objectClassAttribute );
       
        attributes.put( "m-oid", "testOID" );
View Full Code Here

TOP

Related Classes of javax.naming.directory.BasicAttribute

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.