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.ldap.client.template; 021 022 023import org.apache.directory.api.ldap.model.entry.Attribute; 024import org.apache.directory.api.ldap.model.entry.Entry; 025import org.apache.directory.api.ldap.model.entry.Value; 026import org.apache.directory.api.ldap.model.message.AddRequest; 027import org.apache.directory.api.ldap.model.message.DeleteRequest; 028import org.apache.directory.api.ldap.model.message.ModifyRequest; 029import org.apache.directory.api.ldap.model.message.SearchRequest; 030import org.apache.directory.api.ldap.model.message.SearchScope; 031import org.apache.directory.api.ldap.model.name.Dn; 032import org.apache.directory.ldap.client.api.search.FilterBuilder; 033 034 035/** 036 * A factory for creating {@link org.apache.directory.api.ldap.model} objects. 037 * 038 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 039 */ 040public interface ModelFactory 041{ 042 /** 043 * Returns a new <code>AddRequest</code> for the <code>entry</code>. 044 * 045 * @param entry 046 * @return 047 */ 048 public AddRequest newAddRequest( Entry entry ); 049 050 051 /** 052 * Returns a new Attribute for with the provided <code>name</code> and 053 * <code>value(s)</code>. 054 * 055 * @param name 056 * @param values 057 * @return 058 */ 059 public Attribute newAttribute( String name, byte[]... values ); 060 061 062 /** 063 * Returns a new Attribute for with the provided <code>name</code> and 064 * <code>value(s)</code>. 065 * 066 * @param name 067 * @param values 068 * @return 069 */ 070 public Attribute newAttribute( String name, String... values ); 071 072 073 /** 074 * Returns a new Attribute for with the provided <code>name</code> and 075 * <code>value(s)</code>. 076 * 077 * @param name 078 * @param values 079 * @return 080 */ 081 public Attribute newAttribute( String name, Value<?>... values ); 082 083 084 /** 085 * Returns a new <code>DeleteRequest</code> for the <code>dn</code>. 086 * 087 * @param dn 088 * @return 089 */ 090 public DeleteRequest newDeleteRequest( Dn dn ); 091 092 093 /** 094 * Returns a <code>Dn</code> that represents <code>dn</code>. 095 * 096 * @param dn 097 * @return 098 */ 099 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}