Package javax.naming.directory

Examples of javax.naming.directory.ModificationItem


        // 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
View Full Code Here


       
        // 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 );
View Full Code Here

        DN dn = getObjectClassContainer( "apachemeta" );
        dn.add( "m-oid" + "=" + OID );
       
        ModificationItem[] mods = new ModificationItem[2];
        Attribute attr = new BasicAttribute( "m-description", DESCRIPTION1 );
        mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        attr = new BasicAttribute( "m-name", NEW_NAME );
        mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        getSchemaContext( service ).modifyAttributes( dn, mods );

        assertTrue( "objectClass OID should still be present",
            getObjectClassRegistry().contains( OID ) );
       
View Full Code Here

        DN dn = getMatchingRuleContainer( "apachemeta" );
        dn.add( "m-oid" + "=" + OID );
       
        ModificationItem[] mods = new ModificationItem[2];
        Attribute attr = new BasicAttribute( "m-description", DESCRIPTION1 );
        mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        attr = new BasicAttribute( "m-syntax", SchemaConstants.DIRECTORY_STRING_SYNTAX );
        mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        getSchemaContext( service ).modifyAttributes( dn, mods );

        assertTrue( "matchingRule OID should still be present",
            schemaManager.getMatchingRuleRegistry().contains( OID ) );
       
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
View Full Code Here

        DN dn = getAttributeTypeContainer( "apachemeta" );
        dn.add( "m-oid=" + OID );
       
        ModificationItem[] mods = new ModificationItem[2];
        Attribute attr = new BasicAttribute( "m-description", DESCRIPTION1 );
        mods[0] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        attr = new BasicAttribute( "m-syntax", SchemaConstants.DIRECTORY_STRING_SYNTAX );
        mods[1] = new ModificationItem( DirContext.REPLACE_ATTRIBUTE, attr );
        getSchemaContext( service ).modifyAttributes( dn, mods );

        assertTrue( "attributeType OID should still be present",
            service.getSchemaManager().getAttributeTypeRegistry().contains( OID ) );
       
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 );
        }

        Partition systemPartition = service.getSystemPartition();
        Set<Index<? extends Object, ServerEntry, Long>> indexedAtributes = ( ( JdbmPartition ) systemPartition )
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 );
        }

        // -------------------------------------------------------------------
        // Enable the krb5kdc schema
        // -------------------------------------------------------------------
        // Check if krb5kdc is loaded
        if ( !service.getSchemaManager().isSchemaLoaded( "krb5kdc" ) )
        {
            service.getSchemaManager().load( "krb5kdc" );
        }

        // check if krb5kdc is disabled
        Attributes krb5kdcAttrs = schemaRoot.getAttributes( "cn=krb5kdc" );
        boolean isKrb5kdcDisabled = false;
       
        if ( krb5kdcAttrs.get( "m-disabled" ) != null )
        {
            isKrb5kdcDisabled = ( ( String ) krb5kdcAttrs.get( "m-disabled" ).get() ).equalsIgnoreCase( "TRUE" );
        }

        // if krb5kdc is disabled then enable it
        if ( isKrb5kdcDisabled )
        {
            Attribute disabled = new BasicAttribute( "m-disabled" );
            ModificationItem[] mods = new ModificationItem[] {
                new ModificationItem( DirContext.REMOVE_ATTRIBUTE, disabled ) };
            schemaRoot.modifyAttributes( "cn=krb5kdc", mods );
        }
    }
View Full Code Here

        List<ModificationItem> mods = new ArrayList<ModificationItem>();
        NamingEnumeration<? extends Attribute> list = changes.getAll();
        while ( list.hasMore() )
        {
            Attribute attr = list.next();
            mods.add( new ModificationItem( modOp, attr ) );
        }
        ModificationItem[] modArray = new ModificationItem[mods.size()];
        return mods.toArray( modArray );
    }
View Full Code Here

    private void addAdministrativeRole( String role ) throws Exception
    {
        Attribute attribute = new BasicAttribute( "administrativeRole" );
        attribute.add( role );
        ModificationItem item = new ModificationItem( DirContext.ADD_ATTRIBUTE, attribute );
        getSystemContext( service ).modifyAttributes( "", new ModificationItem[] { item } );
    }
View Full Code Here

TOP

Related Classes of javax.naming.directory.ModificationItem

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.