Examples of DefaultClientEntry


Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

            modReq.add( "administrativeRole", SubentryInterceptor.AC_AREA );
            connection.modify( modReq );
        }

        // now add the A/C subentry below ou=system
        Entry subEntry = new DefaultClientEntry( new DN( "cn=" + cn + "," + ServerDNConstants.SYSTEM_DN ) );
        subEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC,
            SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC );
        subEntry.add( SchemaConstants.SUBTREE_SPECIFICATION_AT, subtree );
        subEntry.add( SchemaConstants.PRESCRIPTIVE_ACI_AT, aciItem );

        AddResponse addResp = connection.add( subEntry );

        return addResp.getLdapResult().getResultCode();
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

        try
        {
            DN userName = new DN( "uid=" + uid + ",ou=users,ou=system" );
            LdapConnection connection = getConnectionAs( userName, password );

            Entry entry = new DefaultClientEntry( new DN( "ou=testou,ou=system" ) );
            entry.add( SchemaConstants.OU_AT, "testou" );
            entry.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
           
            AddResponse resp = connection.add( entry );
           
            if( resp.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
            {
                return false;
            }

            connection.delete( entry.getDn() );
            connection.close();
           
            return true;
        }
        catch ( LdapException e )
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    {
        StringReader strIn = new StringReader( text );
        BufferedReader in = new BufferedReader( strIn );

        String line = null;
        Entry entry = new DefaultClientEntry();

        try
        {
            while ( ( line = in.readLine() ) != null )
            {
                if ( line.length() == 0 )
                {
                    continue;
                }

                String addedLine = line.trim();

                if ( StringTools.isEmpty( addedLine ) )
                {
                    continue;
                }

                EntryAttribute attribute = LdifReader.parseAttributeValue( addedLine );
                EntryAttribute oldAttribute = entry.get( attribute.getId() );

                if ( oldAttribute != null )
                {
                    try
                    {
                        oldAttribute.add( attribute.get() );
                        entry.put( oldAttribute );
                    }
                    catch ( LdapException ne )
                    {
                        // Do nothing
                    }
                }
                else
                {
                    try
                    {
                        entry.put( attribute );
                    }
                    catch ( LdapException ne )
                    {
                        // TODO do nothing ...
                    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    })
public class AddingEntriesWithSpecialCharactersInRDNIT extends AbstractLdapTestUnit
{
    private Entry getPersonEntry( String sn, String cn ) throws LdapException
    {
        Entry entry = new DefaultClientEntry();
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "person" );
        entry.add( SchemaConstants.CN_AT, cn );
        entry.add( SchemaConstants.SN_AT, sn );
       
        return entry;
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    }


    private Entry getOrgUnitEntry( String ou ) throws LdapException
    {
        Entry entry = new DefaultClientEntry();
        entry.add( SchemaConstants.OBJECT_CLASS_AT, "organizationalUnit" );
        entry.add( SchemaConstants.OU_AT, ou );
       
        return entry;
    }
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

     * @throws Exception if there are failures accessing the underlying store
     */
    @SuppressWarnings("unchecked")
    public Entry getAttributes( Store<Object, Long> store, Long id ) throws Exception
    {
        Entry entry = new DefaultClientEntry();

        // Get the distinguishedName to id mapping
        entry.put( "_nDn", store.getEntryDn( id ) );
        entry.put( "_upDn", store.getEntryUpdn( id ) );
        entry.put( "_parent", Long.toString( store.getParentId( id ) ) );

        // Get all standard index attribute to value mappings
        for ( Index index : store.getUserIndices() )
        {
            Cursor<ForwardIndexEntry> list = index.reverseCursor();
            ForwardIndexEntry recordForward = new ForwardIndexEntry();
            recordForward.setId( id );
            list.before( recordForward );

            while ( list.next() )
            {
                IndexEntry rec = list.get();
                String val = rec.getValue().toString();
                String attrId = index.getAttribute().getName();
                EntryAttribute attr = entry.get( attrId );

                if ( attr == null )
                {
                    attr = new DefaultClientAttribute( attrId );
                }

                attr.add( val );
                entry.put( attr );
            }
        }

        // Get all existence mappings for this id creating a special key
        // that looks like so 'existence[attribute]' and the value is set to id
        IndexCursor<String, Object, Long> list = store.getPresenceIndex().reverseCursor();
        ForwardIndexEntry recordForward = new ForwardIndexEntry();
        recordForward.setId( id );
        list.before( recordForward );
        StringBuffer val = new StringBuffer();

        while ( list.next() )
        {
            IndexEntry rec = list.get();
            val.append( "_existence[" );
            val.append( rec.getValue().toString() );
            val.append( "]" );

            String valStr = val.toString();
            EntryAttribute attr = entry.get( valStr );

            if ( attr == null )
            {
                attr = new DefaultClientAttribute( valStr );
            }

            attr.add( rec.getId().toString() );
            entry.put( attr );
            val.setLength( 0 );
        }

        // Get all parent child mappings for this entry as the parent using the
        // key 'child' with many entries following it.
        IndexCursor<Long, Object, Long> children = store.getOneLevelIndex().forwardCursor();
        ForwardIndexEntry longRecordForward = new ForwardIndexEntry();
        recordForward.setId( id );
        children.before( longRecordForward );

        EntryAttribute childAttr = new DefaultClientAttribute( "_child" );
        entry.put( childAttr );

        while ( children.next() )
        {
            IndexEntry rec = children.get();
            childAttr.add( rec.getId().toString() );
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    public void testAddEntryWithTwoDescriptions() throws Exception
    {
        LdapConnection con = getClientApiConnection( ldapServer );
       
        String dn = "cn=Kate Bush," + BASE;
        Entry kate = new DefaultClientEntry( new DN( dn ) );

        kate.add( "objectclass", "top", "person" );
        kate.add( "sn", "Bush" );
        kate.add( "cn", "Kate Bush" );

        String descr[] =
            { "a British singer-songwriter with an expressive four-octave voice",
                "one of the most influential female artists of the twentieth century" };

        kate.add( "description", descr );

        con.add( kate );

        // Analyze entry and description attribute
        Entry kateReloaded = ( ( SearchResultEntry ) con.lookup( dn ) ).getEntry();
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    public void testAddEntryWithTwoDescriptionsVariant() throws Exception
    {
        LdapConnection con = getClientApiConnection( ldapServer );

        String dn = "cn=Kate Bush," + BASE;
        Entry kate = new DefaultClientEntry( new DN( dn ) );
        kate.add( "objectclass", "top", "person" );
        kate.add( "sn", "Bush" );
        kate.add( "cn", "Kate Bush" );

        String descr[] =
            { "a British singer-songwriter with an expressive four-octave voice",
                "one of the most influential female artists of the twentieth century" };

        kate.add( "description", descr[0] );
        kate.add( "description", descr[1] );

        con.add( kate );

        // Analyze entry and description attribute
        Entry kateReloaded = ( (SearchResultEntry ) con.lookup( dn ) ).getEntry();
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    public void testAddEntryWithTwoDescriptionsSecondVariant() throws Exception
    {
        LdapConnection con = getClientApiConnection( ldapServer );

        String dn = "cn=Kate Bush," + BASE;
        Entry kate = new DefaultClientEntry( new DN( dn ) );
       
        kate.add( "objectclass", "top", "person" );
        kate.add( "sn", "Bush" );

        String descr[] =
            { "a British singer-songwriter with an expressive four-octave voice",
                "one of the most influential female artists of the twentieth century" };

        kate.add( "description", descr[0] );
        kate.add( "cn", "Kate Bush" );
        kate.add( "description", descr[1] );

        con.add( kate );

        // Analyze entry and description attribute
        Entry kateReloaded = ( ( SearchResultEntry ) con.lookup( dn ) ).getEntry();
View Full Code Here

Examples of org.apache.directory.shared.ldap.entry.client.DefaultClientEntry

    public void testAddEntryUUIDAndCSNAttributes() throws Exception
    {
        LdapConnection con = getClientApiConnection( ldapServer );
       
        String dn = "cn=Kate Bush," + BASE;
        Entry entry = new DefaultClientEntry( new DN( dn ) );
        entry.add( "objectclass", "top", "person" );
        entry.add( "sn", "Bush" );
        entry.add( "cn", "Kate Bush" );

        String descr = "a British singer-songwriter with an expressive four-octave voice";
        entry.add( "description", descr );

        UUID uuid = UUID.randomUUID();
        entry.add( SchemaConstants.ENTRY_UUID_AT, uuid.toString() );

        CsnFactory csnFac = new CsnFactory( 0 );
        Csn csn = csnFac.newInstance();
        entry.add( SchemaConstants.ENTRY_CSN_AT, csn.toString() );
       
        con.add( entry );

        // Analyze entry and description attribute
        SearchResultEntry resp = ( SearchResultEntry ) con.lookup( dn, "*", "+" );
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.