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.core.authz.support;
21
22
23 import java.util.ArrayList;
24 import java.util.Iterator;
25 import java.util.List;
26 import java.util.Map;
27
28 import javax.naming.NamingException;
29
30 import org.apache.directory.server.core.authz.support.ACITupleFilter;
31 import org.apache.directory.server.schema.registries.OidRegistry;
32
33
34 /**
35 * A mock {@link OidRegistry} to test {@link ACITupleFilter} implementations.
36 *
37 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
38 * @version $Rev: 493222 $, $Date: 2007-01-05 23:52:55 +0100 (Fr, 05 Jan 2007) $
39 *
40 */
41 class DummyOidRegistry implements OidRegistry
42 {
43 public String getOid( String name ) throws NamingException
44 {
45 return name.toLowerCase();
46 }
47
48
49 public boolean hasOid( String id )
50 {
51 return true;
52 }
53
54
55 public String getPrimaryName( String oid ) throws NamingException
56 {
57 return oid;
58 }
59
60
61 public List<String> getNameSet( String oid ) throws NamingException
62 {
63 List<String> list = new ArrayList<String>();
64 list.add( oid );
65 return list;
66 }
67
68
69 public Iterator list()
70 {
71 // Not used
72 return new ArrayList().iterator();
73 }
74
75
76 public void register( String name, String oid )
77 {
78 // Not used
79 }
80
81
82 /**
83 * Get the map of all the oids by their name
84 * @return The Map that contains all the oids
85 */
86 public Map getOidByName()
87 {
88 return null;
89 }
90
91
92 /**
93 * Get the map of all the oids by their name
94 * @return The Map that contains all the oids
95 */
96 public Map getNameByOid()
97 {
98 return null;
99 }
100
101
102 public void unregister( String numericOid ) throws NamingException
103 {
104 }
105 }