View Javadoc

1   /*
2    *   Copyright 2004 The Apache Software Foundation
3    *
4    *   Licensed under the Apache License, Version 2.0 (the "License");
5    *   you may not use this file except in compliance with the License.
6    *   You may obtain a copy of the License at
7    *
8    *       http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *   Unless required by applicable law or agreed to in writing, software
11   *   distributed under the License is distributed on an "AS IS" BASIS,
12   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *   See the License for the specific language governing permissions and
14   *   limitations under the License.
15   *
16   */
17  package org.apache.ldap.server.invocation;
18  
19  
20  import org.apache.ldap.common.filter.ExprNode;
21  import org.apache.ldap.server.BackingStore;
22  
23  import javax.naming.Name;
24  import javax.naming.NamingException;
25  import javax.naming.directory.SearchControls;
26  import java.util.Map;
27  
28  
29  /***
30   * Represents an {@link Invocation} on {@link BackingStore#search(Name, Map, ExprNode, SearchControls)}.
31   *
32   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33   * @version $Rev: 159467 $, $Date: 2005-03-30 02:38:30 -0500 (Wed, 30 Mar 2005) $
34   */
35  public class Search extends Invocation
36  {
37      private static final long serialVersionUID = 3258410651234678579L;
38  
39      private Name baseName;
40  
41      private final Map environment;
42  
43      private final ExprNode filter;
44  
45      private final SearchControls controls;
46  
47  
48      public Search( Name baseName, Map environment, ExprNode filters,
49                     SearchControls controls )
50      {
51          if ( baseName == null )
52          {
53              throw new NullPointerException( "baseName" );
54          }
55          if ( environment == null )
56          {
57              throw new NullPointerException( "environment" );
58          }
59          if ( filters == null )
60          {
61              throw new NullPointerException( "filter" );
62          }
63          if ( controls == null )
64          {
65              throw new NullPointerException( "controls" );
66          }
67  
68          this.baseName = baseName;
69  
70          this.environment = environment;
71  
72          this.filter = filters;
73  
74          this.controls = controls;
75      }
76  
77  
78      public Name getBaseName()
79      {
80          return baseName;
81      }
82  
83  
84      public Map getEnvironment()
85      {
86          return environment;
87      }
88  
89  
90      public ExprNode getFilter()
91      {
92          return filter;
93      }
94  
95  
96      public SearchControls getControls()
97      {
98          return controls;
99      }
100 
101 
102     protected Object doExecute( BackingStore store ) throws NamingException
103     {
104         return store.search( baseName, environment, filter, controls );
105     }
106 
107 
108     public void setBaseName( Name baseName )
109     {
110         this.baseName = baseName;
111     }
112 }