Package org.apache.directory.shared.ldap.model.entry

Examples of org.apache.directory.shared.ldap.model.entry.DefaultEntry


    {
        String user = "user"+ entryCount.incrementAndGet();
       
        String dn = "cn=" + user + ",dc=example,dc=com";
       
        DefaultEntry entry = new DefaultEntry( schemaManager, dn,
            "objectClass", "person",
            "cn", user,
            "sn", user );
       
        return entry;
View Full Code Here


                    DirectoryService ds = consumerServer.getDirectoryService();
                   
                    Dn configDn = new Dn( ds.getSchemaManager(), "ads-replConsumerId=localhost,ou=system" );
                    consumer.getConfig().setConfigEntryDn( configDn );
                   
                    Entry provConfigEntry = new DefaultEntry( ds.getSchemaManager(), configDn,
                        "objectClass: ads-replConsumer",
                        "ads-replConsumerId: localhost",
                        "ads-searchBaseDN", consumer.getConfig().getBaseDn(),
                        "ads-replProvHostName", consumer.getConfig().getRemoteHost(),
                        "ads-replProvPort", String.valueOf( consumer.getConfig().getRemotePort() ),
                        "ads-replRefreshInterval", String.valueOf( consumer.getConfig().getRefreshInterval() ),
                        "ads-replRefreshNPersist", String.valueOf( consumer.getConfig().isRefreshNPersist() ),
                        "ads-replSearchScope", consumer.getConfig().getSearchScope().getLdapUrlValue(),
                        "ads-replSearchFilter", consumer.getConfig().getFilter(),
                        "ads-replSearchSizeLimit", String.valueOf( consumer.getConfig().getSearchSizeLimit() ),
                        "ads-replSearchTimeOut", String.valueOf( consumer.getConfig().getSearchTimeout() ),
                        "ads-replUserDn", consumer.getConfig().getReplUserDn(),
                        "ads-replUserPassword", consumer.getConfig().getReplUserPassword() );
                   
                    provConfigEntry.put( "ads-replAliasDerefMode", consumer.getConfig().getAliasDerefMode().getJndiValue() );
                    provConfigEntry.put( "ads-replAttributes", consumer.getConfig().getAttributes() );

                   
                    consumerSession = consumerServer.getDirectoryService().getAdminSession();
                    consumerSession.add( provConfigEntry );
                }
View Full Code Here

                    if ( !session.exists( remoteDn ) )
                    {
                        //System.out.println( "C: " + remoteDn + " does not exist, adding it" );
                        LOG.debug( "adding entry with dn {}", remoteDn );
                        LOG.debug( remoteEntry.toString() );
                        session.add( new DefaultEntry( schemaManager, remoteEntry ) );
                    }
                    else
                    {
                        //System.out.println( "C: " + remoteDn + " exists, modifying it" );
                        LOG.debug( "updating entry in refreshOnly mode {}", remoteDn );
View Full Code Here

        LdifEntry forward = new LdifEntry();
        forward.setChangeType( ChangeType.Delete );
        forward.setDn( deleteContext.getDn() );
       
        Entry reverseEntry = new DefaultEntry( serverEntry.getDn() );
       
        boolean isCollectiveSubentry = serverEntry.hasObjectClass( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC );

        for ( Attribute attribute : serverEntry )
        {
            // filter collective attributes, they can't be added by the revert operation
            AttributeType at = schemaManager.lookupAttributeTypeRegistry( attribute.getId() );
           
            if ( !at.isCollective() || isCollectiveSubentry )
            {
                reverseEntry.add( attribute.clone() );
            }
        }

        LdifEntry reverse = LdifRevertor.reverseDel( deleteContext.getDn(), reverseEntry );
        deleteContext.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
View Full Code Here

            mods.add( modItem );
           
            forward.addModification( modItem );
        }
       
        Entry clientEntry = new DefaultEntry( serverEntry.getDn() );
       
        for ( Attribute attribute:serverEntry )
        {
            clientEntry.add( attribute.clone() );
        }

        LdifEntry reverse = LdifRevertor.reverseModify(
            modifyContext.getDn(),
            mods,
View Full Code Here

        assertEquals( csn, updateCsn );
        assertEquals( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
       
        csn = csnF.newInstance().toString();
       
        Entry modEntry = new DefaultEntry( schemaManager );
        modEntry.add( csnAt, csn );
       
        assertNotSame( csn, updateCsn );
        assertNotSame( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
       
        lookedup = partition.modify( dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, csnAt, csn ) );
View Full Code Here

    @Test
    public void testEntryParentIdPresence() throws Exception
    {
        Dn dn = new Dn( schemaManager, "cn=user,ou=Sales,o=Good Times Co." );
       
        Entry entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "person" );
        entry.add( "cn", "user" );
        entry.add( "sn", "user sn" );
       
        // add
        StoreUtils.injectEntryInStore( partition, entry );
        verifyParentId( dn );
       
View Full Code Here

    public static void loadExampleData( Store<Entry, Long> store, SchemaManager schemaManager ) throws Exception
    {
        Dn suffixDn = new Dn( schemaManager, "o=Good Times Co." );

        // Entry #1
        Entry entry = new DefaultEntry( schemaManager, suffixDn );
        entry.add( "objectClass", "organization" );
        entry.add( "o", "Good Times Co." );
        entry.add( "postalCode", "1" );
        entry.add( "postOfficeBox", "1" );
        injectEntryInStore( store, entry );

        // Entry #2
        Dn dn = new Dn( schemaManager, "ou=Sales,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "organizationalUnit" );
        entry.add( "ou", "Sales" );
        entry.add( "postalCode", "1" );
        entry.add( "postOfficeBox", "1" );
        injectEntryInStore( store, entry );

        // Entry #3
        dn = new Dn( schemaManager, "ou=Board of Directors,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "organizationalUnit" );
        entry.add( "ou", "Board of Directors" );
        entry.add( "postalCode", "1" );
        entry.add( "postOfficeBox", "1" );
        injectEntryInStore( store, entry );

        // Entry #4
        dn = new Dn( schemaManager, "ou=Engineering,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "organizationalUnit" );
        entry.add( "ou", "Engineering" );
        entry.add( "postalCode", "2" );
        entry.add( "postOfficeBox", "2" );
        injectEntryInStore( store, entry );

        // Entry #5
        dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "person", "organizationalPerson" );
        entry.add( "ou", "Sales" );
        entry.add( "cn", "JOhnny WAlkeR" );
        entry.add( "sn", "WAlkeR" );
        entry.add( "postalCode", "3" );
        entry.add( "postOfficeBox", "3" );
        injectEntryInStore( store, entry );

        // Entry #6
        dn = new Dn( schemaManager, "cn=JIM BEAN,ou=Sales,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "person", "organizationalPerson" );
        entry.add( "ou", "Sales" );
        entry.add( "cn", "JIM BEAN" );
        entry.add( "surName", "BEAN" );
        entry.add( "postalCode", "4" );
        entry.add( "postOfficeBox", "4" );
        injectEntryInStore( store, entry );

        // Entry #7
        dn = new Dn( schemaManager, "ou=Apache,ou=Board of Directors,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "organizationalUnit" );
        entry.add( "ou", "Apache" );
        entry.add( "postalCode", "5" );
        entry.add( "postOfficeBox", "5" );
        injectEntryInStore( store, entry );

        // Entry #8
        dn = new Dn( schemaManager, "cn=Jack Daniels,ou=Engineering,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "person", "organizationalPerson" );
        entry.add( "ou", "Engineering" );
        entry.add( "cn", "Jack Daniels" );
        entry.add( "SN", "Daniels" );
        entry.add( "postalCode", "6" );
        entry.add( "postOfficeBox", "6" );
        injectEntryInStore( store, entry );

        // aliases -------------

        // Entry #9
        dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Apache,ou=Board of Directors,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "alias", "extensibleObject" );
        entry.add( "ou", "Apache" );
        entry.add( "commonName", "Jim Bean" );
        entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
        injectEntryInStore( store, entry );

        // Entry #10
        dn = new Dn( schemaManager, "commonName=Jim Bean,ou=Board of Directors,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "alias", "extensibleObject" );
        entry.add( "commonName", "Jim Bean" );
        entry.add( "aliasedObjectName", "cn=Jim Bean,ou=Sales,o=Good Times Co." );
        injectEntryInStore( store, entry );

        // Entry #11
        dn = new Dn( schemaManager, "2.5.4.3=Johnny Walker,ou=Engineering,o=Good Times Co." );
        entry = new DefaultEntry( schemaManager, dn );
        entry.add( "objectClass", "top", "alias", "extensibleObject" );
        entry.add( "ou", "Engineering" );
        entry.add( "2.5.4.3", "Johnny Walker" );
        entry.add( "aliasedObjectName", "cn=Johnny Walker,ou=Sales,o=Good Times Co." );
        injectEntryInStore( store, entry );
    }
View Full Code Here

        }

        // return nothing
        if ( noAttribute )
        {
            Entry serverEntry = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
        }

        // return everything
        if ( allUserAttributes && allOperationalAttributes )
        {
            Entry rootDSE = getRootDSE( null );
            return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( rootDSE ), searchContext );
        }

        Entry serverEntry = new DefaultEntry( schemaManager, Dn.ROOT_DSE );

        Entry rootDSE = getRootDSE( new GetRootDSEOperationContext( searchContext.getSession() ) );

        for ( Attribute attribute : rootDSE )
        {
            AttributeType type = schemaManager.lookupAttributeTypeRegistry( attribute.getUpId() );

            if ( realIds.contains( type.getOid() ) )
            {
                serverEntry.put( attribute );
            }
            else if ( allUserAttributes && ( type.getUsage() == UsageEnum.USER_APPLICATIONS ) )
            {
                serverEntry.put( attribute );
            }
            else if ( allOperationalAttributes && ( type.getUsage() != UsageEnum.USER_APPLICATIONS ) )
            {
                serverEntry.put( attribute );
            }
        }

        return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
    }
View Full Code Here

        }
       
        SchemaManager schemaManager = directoryService.getSchemaManager();

        Set<String> setOids = new HashSet<String>();
        Entry attrs = new DefaultEntry( schemaManager, Dn.ROOT_DSE );
        boolean returnAllOperationalAttributes = false;

        synchronized( schemaSubentrLock )
        {
            // ---------------------------------------------------------------
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.entry.DefaultEntry

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.