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

Examples of org.apache.directory.shared.ldap.model.ldif.LdifEntry


            {
                return;
            }

            // Getting the context entry
            LdifEntry ldifEntry = itr.next();
            Entry contextEntry = new DefaultEntry( schemaManager, ldifEntry.getEntry() );

            // Checking the context entry
            if ( suffixDn.equals( contextEntry.getDn() ) )
            {
                addMandatoryOpAt( contextEntry );
View Full Code Here


                String syntax = ADSConstants.syntaxMappings.get( proptype );
                String equality = ADSConstants.equalityMappings.get( proptype );
                String ordering = ADSConstants.orderingMappings.get( proptype );
                String substr = ADSConstants.substringMappings.get( proptype );

                schemaElements.add( new LdifEntry( propdn,
                    "objectclass:metaAttributeType",
                    "objectclass:metaTop",
                    "objectclass:top",
                    "m-oid:" + propoid,
                    "m-name:" + propname,
                    "m-description:Property of component type " + componentName,
                    "m-equality:" + equality,
                    "m-ordering:" + ordering,
                    "m-substr:" + substr,
                    "m-syntax:" + syntax,
                    "m-length:0",
                    "m-singleValue:TRUE" ) );

                if ( prop.isMandatory() )
                {
                    ocAttribs.add( "m-must:" + propname );
                }
                else
                {
                    ocAttribs.add( "m-may:" + propname );
                }

            }

            schemaElements.add( new LdifEntry( ocsDn,
                "objectclass:organizationalUnit",
                "objectClass:top",
                "ou:objectClasses" ) );

            String ocoid = ComponentOIDGenerator.generateOCOID( componentBaseOID );
            String ocDn = "m-oid=" + ocoid + "," + ocsDn;

            ocAttribs.add( 0, "m-may:cached" );
            ocAttribs.add( 0, "m-must:ins" );
            ocAttribs.add( 0, "m-must:active" );
            ocAttribs.add( 0, "m-supObjectClass: top" );
            ocAttribs.add( 0, "m-description:Object Class for generating instances of:" + componentName );
            ocAttribs.add( 0, "m-name:" + componentName );
            ocAttribs.add( 0, "m-oid:" + ocoid );
            ocAttribs.add( 0, "objectclass: top" );
            ocAttribs.add( 0, "objectclass: metaTop" );
            ocAttribs.add( 0, "objectclass: metaObjectClass" );

            schemaElements.add( new LdifEntry( ocDn, ocAttribs.toArray() ) );

        }
        catch ( LdapInvalidAttributeValueException e )
        {
            LOG.info( "ADSSchemaManager#generateSchema:  Error(LdapInvalidAttributeValueException) while creating LdifEntry for:  "
View Full Code Here

   
        LdifReader reader = new LdifReader( new StringReader( ldif ) );
   
        while ( reader.hasNext() )
        {
            LdifEntry entry = reader.next();
            getLdapServer().getDirectoryService().getAdminSession().add(
                new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
        }
    }
View Full Code Here

                "ref: ldap://localhost:" + getLdapServer().getPort() + "/c=usa,ou=system\n\n";
   
        LdifReader reader = new LdifReader( new StringReader( ldif ) );
        while ( reader.hasNext() )
        {
            LdifEntry entry = reader.next();
            getLdapServer().getDirectoryService().getAdminSession().add(
                new DefaultEntry( getLdapServer().getDirectoryService().getSchemaManager(), entry.getEntry() ) );
        }
    }
View Full Code Here

                ldifReader.close();

                if ( ( ldifEntries != null ) && !ldifEntries.isEmpty() )
                {
                    // this ldif will have only one entry
                    LdifEntry ldifEntry = ldifEntries.get( 0 );
                    LOG.debug( "Adding entry {}", ldifEntry );

                    Entry serverEntry = new DefaultEntry( schemaManager, ldifEntry.getEntry() );

                    if ( !serverEntry.containsAttribute( SchemaConstants.ENTRY_CSN_AT ) )
                    {
                        serverEntry.put( SchemaConstants.ENTRY_CSN_AT, defaultCSNFactory.newInstance().toString() );
                    }
View Full Code Here

        String ref0 = "ldap://fermi:10389/ou=users,ou=system";
        String ref1 = "ldap://hertz:10389/ou=users,dc=example,dc=com";
        String ref2 = "ldap://maxwell:10389/ou=users,ou=system";
        td.rootCtx = getSystemContext( getService() );

        LdifEntry akarasulu = getUserAddLdif();
        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ), true );

        // -------------------------------------------------------------------
        // Adds a referral entry regardless of referral handling settings
        // -------------------------------------------------------------------
View Full Code Here

{

    @Test
    public void testListSystemAsNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getContext( akarasulu.getDn().getName(), getService(), "ou=system" );
        HashSet<String> set = new HashSet<String>();
        NamingEnumeration<NameClassPair> list = sysRoot.list( "" );

        while ( list.hasMore() )
        {
View Full Code Here


    @Test
    public void testListUsersAsNonAdmin() throws Exception
    {
        LdifEntry akarasulu = getUserAddLdif();
        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );

        LdapContext sysRoot = getContext( akarasulu.getDn().getName(), getService(), "ou=system" );
        HashSet<String> set = new HashSet<String>();
        NamingEnumeration<NameClassPair> list = sysRoot.list( "ou=users" );

        while ( list.hasMore() )
        {
View Full Code Here

    @Test
    public void testListUsersAsAdmin() throws Exception
    {
        LdapContext sysRoot = getSystemContext( getService() );
        HashSet<String> set = new HashSet<String>();
        LdifEntry akarasulu = getUserAddLdif();
        getService().getAdminSession().add(
            new DefaultEntry( getService().getSchemaManager(), akarasulu.getEntry() ) );

        NamingEnumeration<NameClassPair> list = sysRoot.list( "ou=users" );

        while ( list.hasMore() )
        {
View Full Code Here

                "objectclass: top\n" +
                "ou: test\n" +
                "entryUUID: 8c7b24a6-1687-461c-88ea-4d30fc234f9b\n" +
                "entryCSN: 20100919005926.530000Z#000000#000#000000";

        LdifEntry ldifEntry = reader.parseLdif( contextEntryStr ).get( 0 );

        contextEntry = new ClonedServerEntry( new DefaultEntry( schemaManager, ldifEntry.getEntry() ) );
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.model.ldif.LdifEntry

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.