public void startServer()

in spring-apacheds/src/main/java/org/apache/archiva/redback/components/apacheds/DefaultApacheDs.java [193:252]


    public void startServer()
        throws Exception
    {
        logger.info( "Starting Apache Directory Server server." );

        logger.info( "ApacheDS basedir: {}", basedir.getAbsolutePath() );

        File logs = new File( basedir, "logs" );

        if ( !logs.exists() && !logs.mkdirs() )
        {
            throw new Exception( "Could not create logs directory: " + logs.getAbsolutePath() );
        }

        Properties environment = new Properties();
        environment.setProperty( "java.naming.security.authentication", "simple" );
        environment.setProperty( "java.naming.security.principal", "uid=admin,ou=system" );
        if ( password != null )
        {
            environment.setProperty( "java.naming.security.credentials", password );
        }
        MutableServerStartupConfiguration configuration = new MutableServerStartupConfiguration();
        configuration.setWorkingDirectory( basedir );
        configuration.setAllowAnonymousAccess( true );
        //configuration.setEnableNtp( false );
        //configuration.setEnableKerberos( false );
        //configuration.setEnableChangePassword( false );
        LdapConfiguration config = new LdapConfiguration();
        config.setIpPort( port );
        configuration.setLdapConfiguration( config );
        configuration.setEnableNetworking( enableNetworking );
        configuration.setSynchPeriodMillis( 100 );

        if ( configuration.getPartitionConfigurations() == null || ( configuration.getPartitionConfigurations() != null
            && configuration.getPartitionConfigurations().isEmpty() ) )
        {
            configuration.setPartitionConfigurations( partitionConfigurations );
        }
        Properties env = new Properties();
        env.setProperty( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
        if ( password != null )
        {
            env.setProperty( Context.SECURITY_CREDENTIALS, password );
        }
        env.setProperty( Context.SECURITY_AUTHENTICATION, "simple" );
        env.setProperty( Context.PROVIDER_URL, "ou=system" );
        env.setProperty( Context.INITIAL_CONTEXT_FACTORY, ServerContextFactory.class.getName() );
        env.putAll( configuration.toJndiEnvironment() );
        InitialDirContext context = new InitialDirContext( env );

        //Attributes inetAttributes = context.getAttributes( "cn=inetorgperson,ou=schema" );

        //inetAttributes.remove( "m-disabled" );

        this.configuration = configuration;

        logger.info( "Started Apache Directory Server server." );

        stopped = false;
    }