Package org.apache.directory.shared.ldap.name

Examples of org.apache.directory.shared.ldap.name.DN


public class CoreContextFactory implements InitialContextFactory
{
    public synchronized Context getInitialContext( Hashtable env ) throws NamingException
    {
        env = ( Hashtable<String, Object> ) env.clone();
        DN principalDn = null;
       
        try
        {
            principalDn = new DN( getPrincipal( env ) );
        }
        catch ( LdapInvalidDnException lide )
        {
            throw new InvalidNameException( I18n.err( I18n.ERR_733, env ) );
        }
View Full Code Here


            ldapServer = new LdapServer();
            ldapServer.setTransports( new TcpTransport( consumerPort ) );
            ldapServer.setDirectoryService( dirService );
           
            DN suffix = new DN( config.getBaseDn() );
            JdbmPartition partition = new JdbmPartition();
            partition.setSuffix( suffix.getName() );
            partition.setId( "syncrepl" );
            partition.setPartitionDir( new File( workDir, partition.getId() ) );
            partition.setSyncOnWrite( true );
            partition.setSchemaManager( dirService.getSchemaManager() );
View Full Code Here

    /**
     * @see javax.naming.Context#createSubcontext(java.lang.String)
     */
    public Context createSubcontext( String name ) throws NamingException
    {
        return createSubcontext( new DN( name ) );
    }
View Full Code Here

    /**
     * @see javax.naming.Context#createSubcontext(javax.naming.Name)
     */
    public Context createSubcontext( Name name ) throws NamingException
    {
        DN target = buildTarget( name );
        ServerEntry serverEntry = service.newEntry( target );
        serverEntry.add( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, JavaLdapSupport.JCONTAINER_ATTR );

        // Now add the CN attribute, which is mandatory
        RDN rdn = target.getRdn();

        if ( rdn != null )
        {
            if ( SchemaConstants.CN_AT.equals( rdn.getNormType() ) )
            {
View Full Code Here

    /**
     * @see javax.naming.Context#destroySubcontext(java.lang.String)
     */
    public void destroySubcontext( String name ) throws NamingException
    {
        destroySubcontext( new DN( name ) );
    }
View Full Code Here

    /**
     * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
     */
    public void destroySubcontext( Name name ) throws NamingException
    {
        DN target = buildTarget( name );

        if ( target.size() == 0 )
        {
            throw new LdapNoPermissionException( I18n.err( I18n.ERR_492 ) );
        }

        try
View Full Code Here

    /**
     * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
     */
    public void bind( String name, Object obj ) throws NamingException
    {
        bind( new DN( name ), obj );
    }
View Full Code Here

    public void bind( Name name, Object obj ) throws NamingException
    {
        // First, use state factories to do a transformation
        DirStateFactory.Result res = DirectoryManager.getStateToBind( obj, name, this, env, null );

        DN target = buildTarget( name );

        // let's be sure that the Attributes is case insensitive
        ServerEntry outServerEntry = ServerEntryUtils.toServerEntry( AttributeUtils.toCaseInsensitive( res
            .getAttributes() ), target, service.getSchemaManager() );
View Full Code Here

    /**
     * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
     */
    public void rename( String oldName, String newName ) throws NamingException
    {
        rename( new DN( oldName ), new DN( newName ) );
    }
View Full Code Here

    /**
     * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
     */
    public void rename( Name oldName, Name newName ) throws NamingException
    {
        DN oldDn = buildTarget( oldName );
        DN newDn = buildTarget( newName );

        if ( oldDn.size() == 0 )
        {
            throw new LdapNoPermissionException( I18n.err( I18n.ERR_312 ) );
        }

        // calculate parents
        DN oldParent = (DN)oldDn.clone();
        oldParent.remove( oldDn.size() - 1 );
        DN newParent = ( DN ) newDn.clone();
        newParent.remove( newDn.size() - 1 );

        RDN oldRdn = oldDn.getRdn();
        RDN newRdn = newDn.getRdn();
        boolean delOldRdn = true;

View Full Code Here

TOP

Related Classes of org.apache.directory.shared.ldap.name.DN

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.