001    /*
002     * CDDL HEADER START
003     *
004     * The contents of this file are subject to the terms of the
005     * Common Development and Distribution License, Version 1.0 only
006     * (the "License").  You may not use this file except in compliance
007     * with the License.
008     *
009     * You can obtain a copy of the license at
010     * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011     * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012     * See the License for the specific language governing permissions
013     * and limitations under the License.
014     *
015     * When distributing Covered Code, include this CDDL HEADER in each
016     * file and include the License file at
017     * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
018     * add the following below this CDDL HEADER, with the fields enclosed
019     * by brackets "[]" replaced with your own identifying information:
020     *      Portions Copyright [yyyy] [name of copyright owner]
021     *
022     * CDDL HEADER END
023     *
024     *
025     *      Copyright 2008 Sun Microsystems, Inc.
026     */
027    package org.opends.server.core;
028    
029    
030    import java.util.LinkedHashSet;
031    import java.util.List;
032    import org.opends.server.controls.MatchedValuesControl;
033    import org.opends.server.types.ByteString;
034    import org.opends.server.types.Control;
035    import org.opends.server.types.DN;
036    import org.opends.server.types.DereferencePolicy;
037    import org.opends.server.types.DirectoryException;
038    import org.opends.server.types.Entry;
039    import org.opends.server.types.RawFilter;
040    import org.opends.server.types.SearchFilter;
041    import org.opends.server.types.SearchResultEntry;
042    import org.opends.server.types.SearchResultReference;
043    import org.opends.server.types.SearchScope;
044    
045    
046    /**
047     * This abstract class wraps/decorates a given search operation.
048     * This class will be extended by sub-classes to enhance the
049     * functionality of the SearchOperationBasis.
050     */
051    public abstract class SearchOperationWrapper extends OperationWrapper
052           implements SearchOperation
053    {
054      // The wrapped operation.
055      private SearchOperation search;
056    
057      /**
058       * Creates a new search operation based on the provided search operation.
059       *
060       * @param search The search operation to wrap
061       */
062      protected SearchOperationWrapper(SearchOperation search)
063      {
064        super(search);
065        this.search = search;
066      }
067    
068      /**
069       * {@inheritDoc}
070       */
071      public boolean returnEntry(Entry entry, List<Control> controls)
072      {
073        boolean result;
074    
075        result = this.search.returnEntry(entry, controls);
076    
077        return result;
078      }
079    
080      /**
081       * {@inheritDoc}
082       */
083      public boolean returnReference(DN dn, SearchResultReference reference)
084      {
085        boolean result;
086    
087        result = this.search.returnReference(dn, reference);
088    
089        return result;
090      }
091    
092      /**
093       * {@inheritDoc}
094       */
095      public String toString()
096      {
097        return search.toString();
098      }
099    
100      /**
101       * {@inheritDoc}
102       */
103      public LinkedHashSet<String> getAttributes()
104      {
105        return search.getAttributes();
106      }
107    
108      /**
109       * {@inheritDoc}
110       */
111      public DN getBaseDN()
112      {
113        return search.getBaseDN();
114      }
115    
116      /**
117       * {@inheritDoc}
118       */
119      public DereferencePolicy getDerefPolicy()
120      {
121        return search.getDerefPolicy();
122      }
123    
124      /**
125       * {@inheritDoc}
126       */
127      public int getEntriesSent()
128      {
129        return search.getEntriesSent();
130      }
131    
132      /**
133       * {@inheritDoc}
134       */
135      public SearchFilter getFilter()
136      {
137        return search.getFilter();
138      }
139    
140      /**
141       * {@inheritDoc}
142       */
143      public ByteString getRawBaseDN()
144      {
145        return search.getRawBaseDN();
146      }
147    
148      /**
149       * {@inheritDoc}
150       */
151      public RawFilter getRawFilter()
152      {
153        return search.getRawFilter();
154      }
155    
156      /**
157       * {@inheritDoc}
158       */
159      public int getReferencesSent()
160      {
161        return search.getReferencesSent();
162      }
163    
164      /**
165       * {@inheritDoc}
166       */
167      public SearchScope getScope()
168      {
169        return search.getScope();
170      }
171    
172      /**
173       * {@inheritDoc}
174       */
175      public int getSizeLimit()
176      {
177        return search.getSizeLimit();
178      }
179    
180      /**
181       * {@inheritDoc}
182       */
183      public int getTimeLimit()
184      {
185        return search.getTimeLimit();
186      }
187    
188      /**
189       * {@inheritDoc}
190       */
191      public boolean getTypesOnly()
192      {
193        return search.getTypesOnly();
194      }
195    
196      /**
197       * {@inheritDoc}
198       */
199      public void sendSearchResultDone()
200      {
201        search.sendSearchResultDone();
202      }
203    
204      /**
205       * {@inheritDoc}
206       */
207      public void setAttributes(LinkedHashSet<String> attributes)
208      {
209        search.setAttributes(attributes);
210      }
211    
212      /**
213       * {@inheritDoc}
214       */
215      public void setBaseDN(DN baseDN)
216      {
217        search.setBaseDN(baseDN);
218      }
219    
220      /**
221       * {@inheritDoc}
222       */
223      public void setDerefPolicy(DereferencePolicy derefPolicy)
224      {
225        search.setDerefPolicy(derefPolicy);
226      }
227    
228      /**
229       * {@inheritDoc}
230       */
231      public void setRawBaseDN(ByteString rawBaseDN)
232      {
233        search.setRawBaseDN(rawBaseDN);
234      }
235    
236      /**
237       * {@inheritDoc}
238       */
239      public void setRawFilter(RawFilter rawFilter)
240      {
241        search.setRawFilter(rawFilter);
242      }
243    
244      /**
245       * {@inheritDoc}
246       */
247      public void setScope(SearchScope scope)
248      {
249        search.setScope(scope);
250      }
251    
252      /**
253       * {@inheritDoc}
254       */
255      public void setSizeLimit(int sizeLimit)
256      {
257        search.setSizeLimit(sizeLimit);
258      }
259    
260      /**
261       * {@inheritDoc}
262       */
263      public void setTimeLimit(int timeLimit)
264      {
265        search.setTimeLimit(timeLimit);
266      }
267    
268      /**
269       * {@inheritDoc}
270       */
271      public void setTypesOnly(boolean typesOnly)
272      {
273        search.setTypesOnly(typesOnly);
274      }
275    
276      /**
277       * {@inheritDoc}
278       */
279      public void setTimeLimitExpiration(Long timeLimitExpiration)
280      {
281        search.setTimeLimitExpiration(timeLimitExpiration);
282      }
283    
284      /**
285       * {@inheritDoc}
286       */
287      public boolean isReturnLDAPSubentries()
288      {
289        return search.isReturnLDAPSubentries();
290      }
291    
292      /**
293       * {@inheritDoc}
294       */
295      public void setReturnLDAPSubentries(boolean returnLDAPSubentries)
296      {
297        search.setReturnLDAPSubentries(returnLDAPSubentries);
298      }
299    
300      /**
301       * {@inheritDoc}
302       */
303      public MatchedValuesControl getMatchedValuesControl()
304      {
305        return search.getMatchedValuesControl();
306      }
307    
308      /**
309       * {@inheritDoc}
310       */
311      public void setMatchedValuesControl(MatchedValuesControl controls)
312      {
313        search.setMatchedValuesControl(controls);
314      }
315    
316      /**
317       * {@inheritDoc}
318       */
319      public boolean isIncludeUsableControl()
320      {
321        return search.isIncludeUsableControl();
322      }
323    
324      /**
325       * {@inheritDoc}
326       */
327      public void setIncludeUsableControl(boolean includeUsableControl)
328      {
329        search.setIncludeUsableControl(includeUsableControl);
330      }
331    
332      /**
333       * {@inheritDoc}
334       */
335      public void setPersistentSearch(PersistentSearch psearch)
336      {
337        search.setPersistentSearch(psearch);
338      }
339    
340      /**
341       * {@inheritDoc}
342       */
343      public PersistentSearch getPersistentSearch()
344      {
345        return search.getPersistentSearch();
346      }
347    
348      /**
349       * {@inheritDoc}
350       */
351      public Long getTimeLimitExpiration()
352      {
353        return search.getTimeLimitExpiration();
354      }
355    
356      /**
357       * {@inheritDoc}
358       */
359      public boolean isClientAcceptsReferrals()
360      {
361        return search.isClientAcceptsReferrals();
362      }
363    
364      /**
365       * {@inheritDoc}
366       */
367      public void setClientAcceptsReferrals(boolean clientAcceptReferrals)
368      {
369        search.setClientAcceptsReferrals(clientAcceptReferrals);
370      }
371    
372      /**
373       * {@inheritDoc}
374       */
375      public void incrementEntriesSent()
376      {
377        search.incrementEntriesSent();
378      }
379    
380      /**
381       * {@inheritDoc}
382       */
383      public void incrementReferencesSent()
384      {
385        search.incrementReferencesSent();
386      }
387    
388      /**
389       * {@inheritDoc}
390       */
391      public boolean isSendResponse()
392      {
393        return search.isSendResponse();
394      }
395    
396      /**
397       * {@inheritDoc}
398       */
399      public void setSendResponse(boolean sendResponse)
400      {
401        search.setSendResponse(sendResponse);
402      }
403    
404      /**
405       * {@inheritDoc}
406       */
407      public boolean isRealAttributesOnly(){
408        return search.isRealAttributesOnly();
409      }
410    
411      /**
412       * {@inheritDoc}
413       */
414      public void setRealAttributesOnly(boolean realAttributesOnly){
415        search.setRealAttributesOnly(realAttributesOnly);
416      }
417    
418      /**
419       * {@inheritDoc}
420       */
421      public boolean isVirtualAttributesOnly(){
422        return search.isVirtualAttributesOnly();
423      }
424    
425      /**
426       * {@inheritDoc}
427       */
428      public void setVirtualAttributesOnly(boolean virtualAttributesOnly){
429        search.setVirtualAttributesOnly(virtualAttributesOnly);
430      }
431    
432      /**
433       * {@inheritDoc}
434       * @throws DirectoryException
435       */
436      public void sendSearchEntry(SearchResultEntry entry)
437        throws DirectoryException
438        {
439        search.sendSearchEntry(entry);
440      }
441    
442      /**
443       * {@inheritDoc}
444       * @throws DirectoryException
445       */
446      public boolean sendSearchReference(SearchResultReference reference)
447        throws DirectoryException
448        {
449        return search.sendSearchReference(reference);
450      }
451    
452      /**
453       * {@inheritDoc}
454       */
455      public DN getProxiedAuthorizationDN()
456      {
457        return search.getProxiedAuthorizationDN();
458      }
459    
460      /**
461       * {@inheritDoc}
462       */
463      public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN){
464        search.setProxiedAuthorizationDN(proxiedAuthorizationDN);
465      }
466    
467    }