Package javax.naming.directory

Examples of javax.naming.directory.InitialDirContext.modifyAttributes()


        substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10001 NAME ( 'bogus2' 'bogusName2' ) " +
            "DESC 'bogus description' SUP name SINGLE-VALUE X-SCHEMA 'nis' )";
        mods[0] = new ModificationItem( DirContext.ADD_ATTRIBUTE,
            new BasicAttribute( "attributeTypes", substrate ) );
        ctx.modifyAttributes( DN.toName( dn ), mods );
       
        // now let's verify the new values for the modification attributes

        subentry = this.getSubschemaSubentryAttributes();
View Full Code Here


            TlsKeyGenerator.PRIVATE_KEY_AT, entry.get( TlsKeyGenerator.PRIVATE_KEY_AT ).getBytes() ) );
        mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.PUBLIC_KEY_AT, entry.get( TlsKeyGenerator.PUBLIC_KEY_AT ).getBytes() ) );
        mods[2] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.USER_CERTIFICATE_AT, entry.get( TlsKeyGenerator.USER_CERTIFICATE_AT ).getBytes() ) );
        ctx.modifyAttributes( "uid=admin,ou=system", mods );
        ctx.close();

        ldapServer.reloadSslContext();
       
        // create a secure connection
View Full Code Here

            TlsKeyGenerator.PRIVATE_KEY_AT, entry.get( TlsKeyGenerator.PRIVATE_KEY_AT ).getBytes() ) );
        mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.PUBLIC_KEY_AT, entry.get( TlsKeyGenerator.PUBLIC_KEY_AT ).getBytes() ) );
        mods[2] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute(
            TlsKeyGenerator.USER_CERTIFICATE_AT, entry.get( TlsKeyGenerator.USER_CERTIFICATE_AT ).getBytes() ) );
        ctx.modifyAttributes( "uid=admin,ou=system", mods );
        ctx.close();

        getLdapServer().reloadSslContext();

        // create a secure connection
View Full Code Here

        // Add the first value for description
        String description1 = "an American singer-songwriter";
        Attribute firstDescr = new BasicAttribute( "description", description1 );
        ModificationItem modification = new ModificationItem(DirContext.ADD_ATTRIBUTE, firstDescr);
        ctx.modifyAttributes(rdn, new ModificationItem[] { modification });

        // Add a second value to description
        String description2 = "Grammy award winning";
        Attribute otherDescr = new BasicAttribute( "description", description2 );
View Full Code Here

        // Add a second value to description
        String description2 = "Grammy award winning";
        Attribute otherDescr = new BasicAttribute( "description", description2 );

        modification = new ModificationItem(DirContext.ADD_ATTRIBUTE, otherDescr );
        ctx.modifyAttributes(rdn, new ModificationItem[] { modification } );
     
        // Add a third value to description
        String description3 = "MTV Music Award winning";
        Attribute thirdDescr = new BasicAttribute( "description", description3 );
View Full Code Here

        // Add a third value to description
        String description3 = "MTV Music Award winning";
        Attribute thirdDescr = new BasicAttribute( "description", description3 );

        modification = new ModificationItem(DirContext.ADD_ATTRIBUTE, thirdDescr );
        ctx.modifyAttributes(rdn, new ModificationItem[] { modification });

        // Search Entry
        SearchControls sctls = new SearchControls();
        sctls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
        String filter = '(' + rdn + ')';
View Full Code Here

        DirContext ctx = new InitialDirContext( env );

        // remove "cn=aaa", which is not part of the RDN
        Attribute attr = new BasicAttribute( "cn", "aaa" );
        ModificationItem modification = new ModificationItem( DirContext.REMOVE_ATTRIBUTE, attr );
        ctx.modifyAttributes( "cn=test", new ModificationItem[]
            { modification } );

        Attributes attrs = ctx.getAttributes( "cn=test", new String[]
            { "cn" } );
        Attribute cn = attrs.get( "cn" );
View Full Code Here

        DirContext ctx = new InitialDirContext( env );

        // replace cn attribute with "cn=test", must remove the previous "cn=aaa"
        Attribute attr = new BasicAttribute( "cn", "test" );
        ModificationItem modification = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        ctx.modifyAttributes( "cn=test", new ModificationItem[]
            { modification } );

        Attributes attrs = ctx.getAttributes( "cn=test", new String[]
            { "cn" } );
        Attribute cn = attrs.get( "cn" );
View Full Code Here

        // try to add an non-existing objectClass "test", must be rejected
        Attribute attr = new BasicAttribute( "objectclass", "test" );
        ModificationItem modification = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
        try
        {
            ctx.modifyAttributes( "cn=test", new ModificationItem[]
                { modification } );
            fail( "Exception expected" );
        }
        catch ( SchemaViolationException sve )
        {
View Full Code Here

        // try to add an unallowed attribute, must be rejected
        Attribute attr = new BasicAttribute( "javaDoc", "test" );
        ModificationItem modification = new ModificationItem( DirContext.ADD_ATTRIBUTE, attr );
        try
        {
            ctx.modifyAttributes( "cn=test", new ModificationItem[]
                { modification } );
            fail( "Exception expected" );
        }
        catch ( SchemaViolationException sve )
        {
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.