attributes.put( "objectClass", "top" ); attributes.put( "objectClass", "organizationalUnit" );
Attribute objectClass = new LockableAttributeImpl( "objectClass" ); objectClass.add( "top" ); objectClass.add( "organizationalUnit" ); attributes.put( objectClass );
    private boolean createBootstrapEntries() throws NamingException    {        boolean firstStart = false;        // -------------------------------------------------------------------        // create admin entry        // -------------------------------------------------------------------        /*         * If the admin entry is there, then the database was already created         */        if ( !partitionNexus.hasEntry( ContextPartitionNexus.getAdminName() ) )        {            checkPermissionToCreateBootstrapEntries();            firstStart = true;            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "person" );            attributes.put( "objectClass", "organizationalPerson" );            attributes.put( "objectClass", "inetOrgPerson" );            attributes.put( "uid", ContextPartitionNexus.ADMIN_UID );            attributes.put( "userPassword", environment.get( Context.SECURITY_CREDENTIALS ) );            attributes.put( "displayName", "Directory Superuser" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            attributes.put( "displayName", "Directory Superuser" );                        partitionNexus.add( ContextPartitionNexus.ADMIN_PRINCIPAL, ContextPartitionNexus.getAdminName(), attributes );        }        // -------------------------------------------------------------------        // create system users area        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "ou=users,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "organizationalUnit" );            attributes.put( "ou", "users" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            partitionNexus.add( "ou=users,ou=system", new LdapName( "ou=users,ou=system" ), attributes );        }        // -------------------------------------------------------------------        // create system groups area        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "ou=groups,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "organizationalUnit" );            attributes.put( "ou", "groups" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            partitionNexus.add( "ou=groups,ou=system", new LdapName( "ou=groups,ou=system" ), attributes );        }        // -------------------------------------------------------------------        // create system configuration area        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "ou=configuration,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "organizationalUnit" );            attributes.put( "ou", "configuration" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            partitionNexus.add( "ou=configuration,ou=system", new LdapName( "ou=configuration,ou=system" ), attributes );        }        // -------------------------------------------------------------------        // create system configuration area for partition information        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "ou=partitions,ou=configuration,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "organizationalUnit" );            attributes.put( "ou", "partitions" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            partitionNexus.add( "ou=partitions,ou=configuration,ou=system",                    new LdapName( "ou=partitions,ou=configuration,ou=system" ), attributes );        }        // -------------------------------------------------------------------        // create system configuration area for services        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "ou=services,ou=configuration,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "organizationalUnit" );            attributes.put( "ou", "services" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            partitionNexus.add( "ou=services,ou=configuration,ou=system",                    new LdapName( "ou=services,ou=configuration,ou=system" ), attributes );        }        // -------------------------------------------------------------------        // create system configuration area for interceptors        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "ou=interceptors,ou=configuration,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "organizationalUnit" );            attributes.put( "ou", "interceptors" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            partitionNexus.add( "ou=interceptors,ou=configuration,ou=system",                    new LdapName( "ou=interceptors,ou=configuration,ou=system" ), attributes );        }        // -------------------------------------------------------------------        // create system preferences area        // -------------------------------------------------------------------        if ( !partitionNexus.hasEntry( new LdapName( "prefNodeName=sysPrefRoot,ou=system" ) ) )        {            firstStart = true;            checkPermissionToCreateBootstrapEntries();            Attributes attributes = new LockableAttributesImpl();            attributes.put( "objectClass", "top" );            attributes.put( "objectClass", "prefNode" );            attributes.put( "objectClass", "extensibleObject" );            attributes.put( "prefNodeName", "sysPrefRoot" );            attributes.put( "creatorsName", ContextPartitionNexus.ADMIN_PRINCIPAL );            attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );            LdapName dn = new LdapName( "prefNodeName=sysPrefRoot,ou=system" );            partitionNexus.add( "prefNodeName=sysPrefRoot,ou=system", dn, attributes );        }        return firstStart;    }