001    /*
002     *  Licensed to the Apache Software Foundation (ASF) under one
003     *  or more contributor license agreements.  See the NOTICE file
004     *  distributed with this work for additional information
005     *  regarding copyright ownership.  The ASF licenses this file
006     *  to you under the Apache License, Version 2.0 (the
007     *  "License"); you may not use this file except in compliance
008     *  with the License.  You may obtain a copy of the License at
009     *  
010     *    http://www.apache.org/licenses/LICENSE-2.0
011     *  
012     *  Unless required by applicable law or agreed to in writing,
013     *  software distributed under the License is distributed on an
014     *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     *  KIND, either express or implied.  See the License for the
016     *  specific language governing permissions and limitations
017     *  under the License. 
018     *  
019     */
020    package org.apache.directory.server.ldap.replication;
021    
022    import org.apache.directory.shared.ldap.filter.SearchScope;
023    
024    /**
025     * 
026     * A class for holding the syncrepl consumer's configuration.
027     *
028     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
029     * @version $Rev$, $Date$
030     */
031    public class SyncreplConfiguration
032    {
033        /** host name of the syncrepl provider server */
034        private String providerHost;
035    
036        /** port number of the syncrepl provider server */
037        private int port;
038    
039        /** bind dn */
040        private String bindDn;
041    
042        /** password for binding with bind dn */
043        private String credentials;
044    
045        /** flag to represent refresh and persist or refreh only mode */
046        private boolean refreshPersist = true;
047    
048        /** time interval for successive sync requests */
049        private long consumerInterval = 5 * 1000;
050    
051        /** the base DN whose content will be searched for syncing */
052        private String baseDn;
053    
054        /** the ldap filter for fetching the entries */
055        private String filter;
056    
057        /** a comma separated string of attribute names */
058        private String attributes;
059    
060        /** the number for setting the limit on number of search results to be fetched
061         * default value is 0 (i.e no limit) */
062        private long searchSizeLimit = 0L;
063    
064        /** the timeout value to be used while doing a search 
065         * default value is 0 (i.e no limit)*/
066        private int searchTimeout = 0;
067    
068        /** the search scope */
069        private int searchScope = SearchScope.ONELEVEL.getScope();
070    
071        /** the replica's id */
072        private int replicaId;
073        
074        /**
075         * @return the providerHost
076         */
077        public String getProviderHost()
078        {
079            return providerHost;
080        }
081    
082        /**
083         * @param providerHost the providerHost to set
084         */
085        public void setProviderHost( String providerHost )
086        {
087            this.providerHost = providerHost;
088        }
089    
090        /**
091         * @return the port
092         */
093        public int getPort()
094        {
095            return port;
096        }
097    
098        /**
099         * @param port the port to set
100         */
101        public void setPort( int port )
102        {
103            this.port = port;
104        }
105    
106        /**
107         * @return the bindDn
108         */
109        public String getBindDn()
110        {
111            return bindDn;
112        }
113    
114        /**
115         * @param bindDn the bindDn to set
116         */
117        public void setBindDn( String bindDn )
118        {
119            this.bindDn = bindDn;
120        }
121    
122        /**
123         * @return the credentials
124         */
125        public String getCredentials()
126        {
127            return credentials;
128        }
129    
130        /**
131         * @param credentials the credentials to set
132         */
133        public void setCredentials( String credentials )
134        {
135            this.credentials = credentials;
136        }
137    
138        /**
139         * @return the refreshPersist
140         */
141        public boolean isRefreshPersist()
142        {
143            return refreshPersist;
144        }
145    
146        /**
147         * @param refreshPersist the refreshPersist to set
148         */
149        public void setRefreshPersist( boolean refreshPersist )
150        {
151            this.refreshPersist = refreshPersist;
152        }
153    
154        /**
155         * @return the consumerInterval
156         */
157        public long getConsumerInterval()
158        {
159            return consumerInterval;
160        }
161    
162        /**
163         * @param consumerInterval the consumerInterval to set
164         */
165        public void setConsumerInterval( long consumerInterval )
166        {
167            this.consumerInterval = consumerInterval;
168        }
169    
170        /**
171         * @return the baseDn
172         */
173        public String getBaseDn()
174        {
175            return baseDn;
176        }
177    
178        /**
179         * @param baseDn the baseDn to set
180         */
181        public void setBaseDn( String baseDn )
182        {
183            this.baseDn = baseDn;
184        }
185    
186        /**
187         * @return the filter
188         */
189        public String getFilter()
190        {
191            return filter;
192        }
193    
194        /**
195         * @param filter the filter to set
196         */
197        public void setFilter( String filter )
198        {
199            this.filter = filter;
200        }
201    
202        /**
203         * @return the attributes
204         */
205        public String getAttributes()
206        {
207            return attributes;
208        }
209    
210        /**
211         * @param attributes the attributes to set
212         */
213        public void setAttributes( String attributes )
214        {
215            this.attributes = attributes;
216        }
217    
218        /**
219         * @return the searchSizeLimit
220         */
221        public long getSearchSizeLimit()
222        {
223            return searchSizeLimit;
224        }
225    
226        /**
227         * @param searchSizeLimit the searchSizeLimit to set
228         */
229        public void setSearchSizeLimit( long searchSizeLimit )
230        {
231            this.searchSizeLimit = searchSizeLimit;
232        }
233    
234        /**
235         * @return the searchTimeout
236         */
237        public int getSearchTimeout()
238        {
239            return searchTimeout;
240        }
241    
242        /**
243         * @param searchTimeout the searchTimeout to set
244         */
245        public void setSearchTimeout( int searchTimeout )
246        {
247            this.searchTimeout = searchTimeout;
248        }
249    
250        /**
251         * @return the searchScope
252         */
253        public int getSearchScope()
254        {
255            return searchScope;
256        }
257    
258        /**
259         * @param searchScope the searchScope to set
260         */
261        public void setSearchScope( int searchScope )
262        {
263            this.searchScope = searchScope;
264        }
265    
266        /**
267         * @return the replicaId
268         */
269        public int getReplicaId()
270        {
271            return replicaId;
272        }
273    
274        /**
275         * @param replicaId the replicaId to set
276         */
277        public void setReplicaId( int replicaId )
278        {
279            this.replicaId = replicaId;
280        }
281    
282        
283        
284    }