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 */
020package org.apache.directory.server.annotations;
021
022
023import java.lang.annotation.Documented;
024import java.lang.annotation.ElementType;
025import java.lang.annotation.Inherited;
026import java.lang.annotation.Retention;
027import java.lang.annotation.RetentionPolicy;
028import java.lang.annotation.Target;
029
030import org.apache.directory.api.ldap.model.constants.LdapConstants;
031import org.apache.directory.api.ldap.model.message.AliasDerefMode;
032import org.apache.directory.api.ldap.model.message.SearchScope;
033
034
035/**
036 * A annotation used to define a replication consumer configuration. Many elements can be configured :
037 * <ul>
038 *   <li>remoteHost : the remote server's name, defaults to 'localhost'</li>
039 *   <li>remotePort : the remote server's LDAP port, defaults to 389</li>
040 *   <li>replUserDn : The replication User's DN</li>
041 *   <li>replUserPassword : The replication User's password</li>
042 *   <li>refreshNPersist : the replication mode, defaults to 'true'</li>
043 *   <li>refreshInterval : the interval between replications when in refreshOnly mode, defaults to 60s</li>
044 *   <li>baseDn : the base from which to fetch entries on the remote server</li>
045 *   <li>filter : the filter to select entries,defaults to (ObjectClass=*)</li>
046 *   <li>attributes : the list of attributes to replicate, defaults to all</li>
047 *   <li>searchSizeLimit : the maximum number of entries to fetch, defaults to no limit</li>
048 *   <li>searchTimeout : the maximum delay to wait for entries, defaults to no limit</li>
049 *   <li>searchScope : the scope, defaults to SUBTREE</li>
050 *   <li>aliasDerefMode : set the aliss derefence policy, defaults to NEVER </li>
051 *   <li>cookie : the replication cookie</li>
052 *   <li>replicaId : the replica identifier</li>
053 *   <li>configEntryDn : the configuration entry's DN</li>
054 *   <li>chaseReferrals : tells if we chase referrals, defaults to false</li>
055 *   <li>useTls : the connection uses TLS, defaults to true</li>
056 *   <li>strictCertVerification : strictly verify the certificate, defaults to true</li>
057 * </ul>
058 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
059 */
060@Documented
061@Inherited
062@Retention(RetentionPolicy.RUNTIME)
063@Target(
064    { ElementType.METHOD, ElementType.TYPE })
065public @interface CreateConsumer
066{
067    /** 
068     * Host name of the syncrepl remote server, default value is ""
069     * 
070     *  @return The remote host
071     */
072    String remoteHost() default "";
073
074
075    /** 
076     * Port number of the syncrepl provider server, default is 389 
077     * 
078     * @return The remote port
079     */
080    int remotePort() default 389;
081
082
083    /** 
084     * Replication user's Dn 
085     * 
086     * @return the replication user's Dn
087     */
088    String replUserDn();
089
090
091    /** 
092     * Password for binding with replication user dn 
093     * 
094     * @return the replication user credentials
095     */
096    String replUserPassword();
097
098
099    /** 
100     * flag to represent refresh and persist or refresh only mode, defaults to true
101     *  
102     * @return <tt>true</tt> if replication is done with a refresh and persist
103     */
104    boolean refreshNPersist() default true;
105
106
107    /** 
108     * Time interval for successive sync requests, default is 60 seconds 
109     * 
110     * @return The refresh interval
111     */
112    long refreshInterval() default 60 * 1000;
113
114
115    /** 
116     * The base Dn whose content will be searched for replicating
117     * 
118     * @return The replication Base DN 
119     */
120    String baseDn();
121
122
123    /** 
124     * The ldap filter for fetching the entries, default value is (objectClass=*)
125     * 
126     *  @return The filter
127     */
128    String filter() default LdapConstants.OBJECT_CLASS_STAR;
129
130
131    /** 
132     * Names of attributes to be replicated, default value is all user attributes
133     * 
134     * @return The replicated attributes
135     */
136    String[] attributes() default "";
137
138
139    /** 
140     * The maximum number of search results to be fetched
141     * default value is 0 (i.e no limit) 
142     * 
143     * @return The search size limit
144     */
145    int searchSizeLimit() default 0;
146
147
148    /** 
149     * The timeout value to be used while doing a search 
150     * default value is 0 (i.e no limit)
151     * 
152     * @return The search time limit
153     */
154    int searchTimeout() default 0;
155
156
157    /** 
158     * The search scope, default is sub tree level 
159     * 
160     * @return the Search scope
161     */
162    SearchScope searchScope() default SearchScope.SUBTREE;
163
164
165    /** 
166     * Alias dereferencing mode, default is set to 'never deref aliases' 
167     * 
168     * @return the Deref Alias mode
169     */
170    AliasDerefMode aliasDerefMode() default AliasDerefMode.NEVER_DEREF_ALIASES;
171
172
173    /**
174     * @return The replica's id
175     */
176    int replicaId();
177
178
179    /** 
180     * @return The configuration entry DN
181     */
182    String configEntryDn() default "";
183
184
185    /** 
186     * flag to indicate whether to chase referrals or not, default is false hence passes ManageDsaITControl 
187     * with syncsearch request
188     * 
189     * @return <tt>true</tt> if referals are chased
190     */
191    boolean chaseReferrals() default false;
192
193
194    /** 
195     * flag to indicate the use of TLS, default is true
196     * 
197     * @return <tt>true</tt> if Tls is in use
198     */
199    boolean useTls() default true;
200
201
202    /** 
203     * flag to indicate the use of strict certificate verification, default is true
204     *  
205     * @return <tt>true</tt> if a strict certificate validation is done
206     */
207    boolean strictCertVerification() default true;
208
209}