1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.ldap.client.template; 21 22 23 import org.apache.directory.api.ldap.model.entry.Attribute; 24 import org.apache.directory.api.ldap.model.entry.Entry; 25 import org.apache.directory.api.ldap.model.entry.Value; 26 import org.apache.directory.api.ldap.model.message.AddRequest; 27 import org.apache.directory.api.ldap.model.message.DeleteRequest; 28 import org.apache.directory.api.ldap.model.message.ModifyRequest; 29 import org.apache.directory.api.ldap.model.message.SearchRequest; 30 import org.apache.directory.api.ldap.model.message.SearchScope; 31 import org.apache.directory.api.ldap.model.name.Dn; 32 import org.apache.directory.ldap.client.api.search.FilterBuilder; 33 34 35 /** 36 * A factory for creating {@link org.apache.directory.api.ldap.model} objects. 37 * 38 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 39 */ 40 public interface ModelFactory 41 { 42 /** 43 * Returns a new <code>AddRequest</code> for the <code>entry</code>. 44 * 45 * @param entry 46 * @return 47 */ 48 public AddRequest newAddRequest( Entry entry ); 49 50 51 /** 52 * Returns a new Attribute for with the provided <code>name</code> and 53 * <code>value(s)</code>. 54 * 55 * @param name 56 * @param values 57 * @return 58 */ 59 public Attribute newAttribute( String name, byte[]... values ); 60 61 62 /** 63 * Returns a new Attribute for with the provided <code>name</code> and 64 * <code>value(s)</code>. 65 * 66 * @param name 67 * @param values 68 * @return 69 */ 70 public Attribute newAttribute( String name, String... values ); 71 72 73 /** 74 * Returns a new Attribute for with the provided <code>name</code> and 75 * <code>value(s)</code>. 76 * 77 * @param name 78 * @param values 79 * @return 80 */ 81 public Attribute newAttribute( String name, Value<?>... values ); 82 83 84 /** 85 * Returns a new <code>DeleteRequest</code> for the <code>dn</code>. 86 * 87 * @param dn 88 * @return 89 */ 90 public DeleteRequest newDeleteRequest( Dn dn ); 91 92 93 /** 94 * Returns a <code>Dn</code> that represents <code>dn</code>. 95 * 96 * @param dn 97 * @return 98 */ 99 public Dn newDn( String dn ); 100 101 102 /** 103 * Returns a <code>Entry</code> with the specified <code>dn</code>. 104 * 105 * @param dn 106 * @return 107 */ 108 public Entry newEntry( String dn ); 109 110 111 /** 112 * Returns a <code>Entry</code> with the specified <code>dn</code>. 113 * 114 * @param dn 115 * @return 116 */ 117 public Entry newEntry( Dn dn ); 118 119 120 /** 121 * Returns a new <code>ModifyRequest</code> for the <code>dn</code>. 122 * 123 * @param dn 124 * @return 125 */ 126 public ModifyRequest newModifyRequest( String dn ); 127 128 129 /** 130 * Returns a new <code>ModifyRequest</code> for the <code>dn</code>. 131 * 132 * @param dn 133 * @return 134 */ 135 public ModifyRequest newModifyRequest( Dn dn ); 136 137 138 /** 139 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 140 * <code>scope</code> matching <code>filter</code> returning 141 * all normal attributes for each matching entry. 142 * 143 * @param baseDn 144 * @param filter 145 * @param scope 146 * @return 147 */ 148 public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter, 149 SearchScope scope ); 150 151 152 /** 153 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 154 * <code>scope</code> matching <code>filter</code> returning 155 * all normal attributes for each matching entry. 156 * 157 * @param baseDn 158 * @param filter 159 * @param scope 160 * @return 161 */ 162 public SearchRequest newSearchRequest( String baseDn, String filter, 163 SearchScope scope ); 164 165 166 /** 167 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 168 * <code>scope</code> matching <code>filter</code> returning 169 * all normal attributes for each matching entry. 170 * 171 * @param baseDn 172 * @param filter 173 * @param scope 174 * @return 175 */ 176 public SearchRequest newSearchRequest( Dn baseDn, String filter, 177 SearchScope scope ); 178 179 180 /** 181 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 182 * <code>scope</code> matching <code>filter</code> returning 183 * all normal attributes for each matching entry. 184 * 185 * @param baseDn 186 * @param filter 187 * @param scope 188 * @return 189 */ 190 public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter, 191 SearchScope scope ); 192 193 194 /** 195 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 196 * <code>scope</code> matching <code>filter</code> returning 197 * <code>attributes</code> for each matching entry. 198 * 199 * @param baseDn 200 * @param filter 201 * @param scope 202 * @param attributes 203 * @return 204 */ 205 public SearchRequest newSearchRequest( String baseDn, String filter, 206 SearchScope scope, String... attributes ); 207 208 209 /** 210 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 211 * <code>scope</code> matching <code>filter</code> returning 212 * <code>attributes</code> for each matching entry. 213 * 214 * @param baseDn 215 * @param filter 216 * @param scope 217 * @param attributes 218 * @return 219 */ 220 public SearchRequest newSearchRequest( String baseDn, FilterBuilder filter, 221 SearchScope scope, String... attributes ); 222 223 224 /** 225 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 226 * <code>scope</code> matching <code>filter</code> returning 227 * <code>attributes</code> for each matching entry. 228 * 229 * @param baseDn 230 * @param filter 231 * @param scope 232 * @param attributes 233 * @return 234 */ 235 public SearchRequest newSearchRequest( Dn baseDn, String filter, 236 SearchScope scope, String... attributes ); 237 238 239 /** 240 * Returns a new <code>SearchRequest</code> over <code>baseDn</code> in 241 * <code>scope</code> matching <code>filter</code> returning 242 * <code>attributes</code> for each matching entry. 243 * 244 * @param baseDn 245 * @param filter 246 * @param scope 247 * @param attributes 248 * @return 249 */ 250 public SearchRequest newSearchRequest( Dn baseDn, FilterBuilder filter, 251 SearchScope scope, String... attributes ); 252 }