1   /*
2    *   @(#) $Id: DummyOidRegistry.java 292666 2005-09-30 07:54:28Z trustin $
3    *
4    *   Copyright 2004 The Apache Software Foundation
5    *
6    *   Licensed under the Apache License, Version 2.0 (the "License");
7    *   you may not use this file except in compliance with the License.
8    *   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, software
13   *   distributed under the License is distributed on an "AS IS" BASIS,
14   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *   See the License for the specific language governing permissions and
16   *   limitations under the License.
17   *
18   */
19  package org.apache.ldap.server.authz.support;
20  
21  import java.util.ArrayList;
22  import java.util.Iterator;
23  import java.util.List;
24  
25  import javax.naming.NamingException;
26  
27  import org.apache.ldap.server.schema.OidRegistry;
28  
29  /***
30   * A mock {@link OidRegistry} to test {@link ACITupleFilter} implementations.
31   *
32   * @author The Apache Directory Project
33   * @version $Rev: 292666 $, $Date: 2005-09-30 03:54:28 -0400 (Fri, 30 Sep 2005) $
34   *
35   */
36  class DummyOidRegistry implements OidRegistry
37  {
38      public String getOid( String name ) throws NamingException
39      {
40          return String.valueOf( name.hashCode() );
41      }
42  
43      public boolean hasOid( String id )
44      {
45          return true;
46      }
47  
48      public String getPrimaryName( String oid ) throws NamingException
49      {
50          return oid;
51      }
52  
53      public List getNameSet( String oid ) throws NamingException
54      {
55          List list = new ArrayList();
56          list.add( oid );
57          return list;
58      }
59  
60      public Iterator list()
61      {
62          // Not used
63          return new ArrayList().iterator();
64      }
65  
66      public void register( String name, String oid )
67      {
68          // Not used
69      }
70      
71  }