1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.schema.bootstrap;
21
22 import java.util.Comparator;
23
24 import javax.naming.NamingException;
25
26 import org.apache.directory.server.schema.registries.OidRegistry;
27 import org.apache.directory.server.schema.registries.Registries;
28 import org.apache.directory.shared.ldap.NotImplementedException;
29 import org.apache.directory.shared.ldap.schema.MatchingRule;
30 import org.apache.directory.shared.ldap.schema.Normalizer;
31 import org.apache.directory.shared.ldap.schema.Syntax;
32
33
34
35
36
37
38
39 public class NameOrNumericIdMatch implements MatchingRule
40 {
41 private static final long serialVersionUID = 1L;
42
43 private final static String[] NAMES = new String[] { "nameOrNumericIdMatch" };
44 private final static String OID = "1.3.6.1.4.1.18060.0.4.0.1.0";
45 private transient Normalizer normalizer;
46 private transient Comparator comparator;
47 private transient Syntax syntax;
48 private final String schema;
49
50
51 public NameOrNumericIdMatch( String schema )
52 {
53 this.syntax = new ApachemetaSyntaxProducer.NameOrNumericIdSyntax();
54 this.schema = schema;
55 }
56
57
58 public NameOrNumericIdMatch( OidRegistry registry, String schema )
59 {
60 this.normalizer = new NameOrNumericIdNormalizer( registry );
61 this.comparator = new NameOrNumericIdComparator( registry );
62 this.syntax = new ApachemetaSyntaxProducer.NameOrNumericIdSyntax();
63 this.schema = schema;
64 }
65
66
67 public void setRegistries( Registries registries )
68 {
69 this.normalizer = new NameOrNumericIdNormalizer( registries.getOidRegistry() );
70 this.comparator = new NameOrNumericIdComparator( registries.getOidRegistry() );
71 this.syntax = new ApachemetaSyntaxProducer.NameOrNumericIdSyntax();
72 }
73
74
75
76
77
78 public Comparator getComparator() throws NamingException
79 {
80 return comparator;
81 }
82
83
84
85
86
87 public Normalizer getNormalizer() throws NamingException
88 {
89 return normalizer;
90 }
91
92
93
94
95
96 public Syntax getSyntax() throws NamingException
97 {
98 return syntax;
99 }
100
101
102
103
104
105 public String getDescription()
106 {
107 return "A name or numeric id matchingRule";
108 }
109
110
111
112
113
114 public String getName()
115 {
116 return NAMES[0];
117 }
118
119
120
121
122
123 public String[] getNamesRef()
124 {
125 return NAMES;
126 }
127
128
129
130
131
132 public String getOid()
133 {
134 return OID;
135 }
136
137
138
139
140
141 public boolean isObsolete()
142 {
143 return false;
144 }
145
146
147 public String getSchema()
148 {
149 return schema;
150 }
151
152
153 public void setSchema( String schemaName )
154 {
155 throw new NotImplementedException();
156 }
157 }