View Javadoc

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.server.xdbm.search.evaluator;
21  
22  
23  import org.apache.directory.api.ldap.model.entry.Entry;
24  import org.apache.directory.api.ldap.model.exception.LdapException;
25  import org.apache.directory.api.ldap.model.filter.UndefinedNode;
26  import org.apache.directory.server.xdbm.IndexEntry;
27  import org.apache.directory.server.xdbm.Store;
28  import org.apache.directory.server.xdbm.search.Evaluator;
29  
30  
31  /**
32   * An Evaluator that always return false, for the case we have no entry to return
33   *
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   */
36  public class EmptyEvaluator implements Evaluator<UndefinedNode>
37  {
38      /** The backend */
39      private final Store db;
40  
41  
42      /**
43       * Create a new instance of the PassThroughEvaluator
44       * @throws Exception
45       */
46      public EmptyEvaluator( Store db )
47      {
48          this.db = db;
49      }
50  
51  
52      /**
53       * {@inheritDoc}
54       */
55      public boolean evaluate( IndexEntry<?, String> indexEntry ) throws LdapException
56      {
57          return false;
58      }
59  
60  
61      /**
62       * {@inheritDoc}
63       */
64      public boolean evaluate( Entry entry ) throws Exception
65      {
66          return false;
67      }
68  
69  
70      /**
71       * Gets the expression used by this expression Evaluator.
72       *
73       * @return the AST for the expression
74       */
75      public UndefinedNode getExpression()
76      {
77          return null;
78      }
79  
80  
81      /**
82       * @see Object#toString()
83       */
84      public String toString( String tabs )
85      {
86          StringBuilder sb = new StringBuilder();
87  
88          sb.append( tabs ).append( "EmptyEvaluator\n" );
89  
90          return sb.toString();
91      }
92  
93  
94      /**
95       * @see Object#toString()
96       */
97      public String toString()
98      {
99          return toString( "" );
100     }
101 }