Examples of ReplicationConsumer


Examples of org.apache.directory.server.ldap.replication.consumer.ReplicationConsumer

        for ( ReplConsumerBean replBean : replConsumerBeans )
        {
            String className = replBean.getReplConsumerImpl();

            ReplicationConsumer consumer = null;
            Class<?> consumerClass = null;
            SyncReplConfiguration config = null;

            try
            {
                if ( className == null )
                {
                    consumer = new ReplicationConsumerImpl();
                }
                else
                {
                    consumerClass = Class.forName( className );
                    consumer = ( ReplicationConsumer ) consumerClass.newInstance();
                }

                // we don't support any other configuration impls atm, but this configuration should suffice for many needs
                config = new SyncReplConfiguration();

                config.setBaseDn( replBean.getSearchBaseDn() );
                config.setRemoteHost( replBean.getReplProvHostName() );
                config.setRemotePort( replBean.getReplProvPort() );
               
                try
                {
                    config.setAliasDerefMode( AliasDerefMode.getDerefMode( replBean.getReplAliasDerefMode() ) );
                }
                catch ( IllegalArgumentException iae )
                {
                    LOG.error( iae.getMessage() + ", defaulted to 'never'" );
                }
               
                config.setAttributes( replBean.getReplAttributes().toArray( new String[0] ) );
                config.setRefreshInterval( replBean.getReplRefreshInterval() );
                config.setRefreshNPersist( replBean.isReplRefreshNPersist() );

                int scope = SearchScope.getSearchScope( replBean.getReplSearchScope() );
                config.setSearchScope( SearchScope.getSearchScope( scope ) );

                config.setFilter( replBean.getReplSearchFilter() );
                config.setSearchTimeout( replBean.getReplSearchTimeout() );
                config.setReplUserDn( replBean.getReplUserDn() );
                config.setReplUserPassword( replBean.getReplUserPassword() );

                config.setUseTls( replBean.isReplUseTls() );
                config.setStrictCertVerification( replBean.isReplStrictCertValidation() );

                config.setConfigEntryDn( replBean.getDn() );

                if ( replBean.getReplPeerCertificate() != null )
                {
                    ReplicationTrustManager.addCertificate( replBean.getReplConsumerId(),
                        replBean.getReplPeerCertificate() );
                }

                consumer.setConfig( config );

                lst.add( consumer );
            }
            catch ( Exception e )
            {
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.