Package javax.naming.ldap

Examples of javax.naming.ldap.LdapContext.createSubcontext()


         * in the entry. This creates a second cn attribute "userPassword:#414243".
         * This is a JNDI hack:
         * If no other userPassword is available in the entry, JNDI adds the Rdn
         * attribute to the entry before sending the request to the server.
         */
        ctx.createSubcontext( " userPassword = #414243 ", binary );

        SearchControls controls = new SearchControls();
        NamingEnumeration<SearchResult> res;

        // search for the implicit added cn
View Full Code Here


                    // use "throw" as we handle referrals manually
                    modCtx.addToEnvironment( Context.REFERRAL, REFERRAL_THROW );

                    // create entry
                    modCtx.createSubcontext( new LdapName( dn ), attributes );
                }
                catch ( ReferralException re )
                {
                    try
                    {
View Full Code Here

        String base = "uid=kevin";

        //create subcontext
        try
        {
            sysRoot.createSubcontext( base, attrs );
            fail( "Should not reach this state" );
        }
        catch ( NamingException e )
        {
            assertTrue( true );
View Full Code Here

        String base = "sn=kevin";

        // create subcontext
        try
        {
            sysRoot.createSubcontext( base, attrs );
            fail( "Should not reach this state" );
        }
        catch ( NamingException e )
        {
            assertTrue( true );
View Full Code Here

            "ObjectClass: inetorgperson",
            "cn: John\\+Doe",
            "sn: \\+Name\\+" );
       
        LdapContext sysRoot = getSystemContext( service );
        DirContext dc = sysRoot.createSubcontext( "cn=John\\+Doe", entry );
       
        ServerLdapContext sc = ( ServerLdapContext ) dc;
       
        assertTrue( sc.getDn().toString().contains( "+" ) );
View Full Code Here

        String dn = "ou=Test";

        Attributes attributes = LdifUtils.createAttributes( "objectClass: top", "objectClass: organizationalUnit",
            "ou: Test" );

        DirContext ctx = ctxRoot.createSubcontext( dn, attributes );
        assertNotNull( ctx );

        SearchControls sc = new SearchControls();
        sc.setSearchScope( SearchControls.OBJECT_SCOPE );
View Full Code Here

        String description = "New Value";

        Attributes attributes = LdifUtils.createAttributes( "objectClass: top", "objectClass: organizationalUnit",
            "ou: Test", "description: Old Value" );

        DirContext ctx = ctxRoot.createSubcontext( dn, attributes );
        assertNotNull( ctx );

        ModificationItem[] mods = new ModificationItem[1];
        mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, new BasicAttribute( "description", description ) );
View Full Code Here

        String dn = "ou=Test";

        Attributes attributes = LdifUtils.createAttributes( "objectClass: top", "objectClass: organizationalUnit",
            "ou: Test" );

        DirContext ctx = ctxRoot.createSubcontext( dn, attributes );
        assertNotNull( ctx );

        ctxRoot.destroySubcontext( dn );

        SearchControls sc = new SearchControls();
View Full Code Here

        Attribute attribute = new BasicAttribute( "objectClass" );
        attribute.add( "top" );
        attribute.add( "organizationalUnit" );
        attributes.put( attribute );
        attributes.put( "ou", "testing00" );
        DirContext ctx = sysRoot.createSubcontext( "ou=testing00", attributes );
        assertNotNull( ctx );

        ctx = ( DirContext ) sysRoot.lookup( "ou=testing00" );
        assertNotNull( ctx );
View Full Code Here

        attribute = new BasicAttribute( "objectClass" );
        attribute.add( "top" );
        attribute.add( "organizationalUnit" );
        attributes.put( attribute );
        attributes.put( "ou", "testing01" );
        ctx = sysRoot.createSubcontext( "ou=testing01", attributes );
        assertNotNull( ctx );

        ctx = ( DirContext ) sysRoot.lookup( "ou=testing01" );
        assertNotNull( ctx );
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.