001 /*
002 * Copyright 2008-2013 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2008-2013 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021 package com.unboundid.ldap.matchingrules;
022
023
024
025 import com.unboundid.asn1.ASN1OctetString;
026 import com.unboundid.util.ThreadSafety;
027 import com.unboundid.util.ThreadSafetyLevel;
028
029 import static com.unboundid.util.StaticUtils.*;
030
031
032
033 /**
034 * This class provides an implementation of a matching rule that performs
035 * byte-for-byte matching.
036 */
037 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
038 public final class OctetStringMatchingRule
039 extends AcceptAllSimpleMatchingRule
040 {
041 /**
042 * The singleton instance that will be returned from the {@code getInstance}
043 * method.
044 */
045 private static final OctetStringMatchingRule INSTANCE =
046 new OctetStringMatchingRule();
047
048
049
050 /**
051 * The name for the octetStringMatch equality matching rule.
052 */
053 public static final String EQUALITY_RULE_NAME = "octetStringMatch";
054
055
056
057 /**
058 * The name for the octetStringMatch equality matching rule, formatted in all
059 * lowercase characters.
060 */
061 static final String LOWER_EQUALITY_RULE_NAME =
062 toLowerCase(EQUALITY_RULE_NAME);
063
064
065
066 /**
067 * The OID for the octetStringMatch equality matching rule.
068 */
069 public static final String EQUALITY_RULE_OID = "2.5.13.17";
070
071
072
073 /**
074 * The name for the octetStringOrderingMatch ordering matching rule.
075 */
076 public static final String ORDERING_RULE_NAME = "octetStringOrderingMatch";
077
078
079
080 /**
081 * The name for the octetStringOrderingMatch ordering matching rule, formatted
082 * in all lowercase characters.
083 */
084 static final String LOWER_ORDERING_RULE_NAME =
085 toLowerCase(ORDERING_RULE_NAME);
086
087
088
089 /**
090 * The OID for the octetStringOrderingMatch ordering matching rule.
091 */
092 public static final String ORDERING_RULE_OID = "2.5.13.18";
093
094
095
096 /**
097 * The name for the octetStringSubstringsMatch substring matching rule.
098 */
099 public static final String SUBSTRING_RULE_NAME = "octetStringSubstringsMatch";
100
101
102
103 /**
104 * The name for the octetStringSubstringsMatch substring matching rule,
105 * formatted in all lowercase characters.
106 */
107 static final String LOWER_SUBSTRING_RULE_NAME =
108 toLowerCase(SUBSTRING_RULE_NAME);
109
110
111
112 /**
113 * The OID for the octetStringSubstringMatch substring matching rule.
114 */
115 public static final String SUBSTRING_RULE_OID = "2.5.13.19";
116
117
118
119 /**
120 * The serial version UID for this serializable class.
121 */
122 private static final long serialVersionUID = -5655018388491186342L;
123
124
125
126 /**
127 * Creates a new instance of this octet string matching rule.
128 */
129 public OctetStringMatchingRule()
130 {
131 // No implementation is required.
132 }
133
134
135
136 /**
137 * Retrieves a singleton instance of this matching rule.
138 *
139 * @return A singleton instance of this matching rule.
140 */
141 public static OctetStringMatchingRule getInstance()
142 {
143 return INSTANCE;
144 }
145
146
147
148 /**
149 * {@inheritDoc}
150 */
151 @Override()
152 public String getEqualityMatchingRuleName()
153 {
154 return EQUALITY_RULE_NAME;
155 }
156
157
158
159 /**
160 * {@inheritDoc}
161 */
162 @Override()
163 public String getEqualityMatchingRuleOID()
164 {
165 return EQUALITY_RULE_OID;
166 }
167
168
169
170 /**
171 * {@inheritDoc}
172 */
173 @Override()
174 public String getOrderingMatchingRuleName()
175 {
176 return ORDERING_RULE_NAME;
177 }
178
179
180
181 /**
182 * {@inheritDoc}
183 */
184 @Override()
185 public String getOrderingMatchingRuleOID()
186 {
187 return ORDERING_RULE_OID;
188 }
189
190
191
192 /**
193 * {@inheritDoc}
194 */
195 @Override()
196 public String getSubstringMatchingRuleName()
197 {
198 return SUBSTRING_RULE_NAME;
199 }
200
201
202
203 /**
204 * {@inheritDoc}
205 */
206 @Override()
207 public String getSubstringMatchingRuleOID()
208 {
209 return SUBSTRING_RULE_OID;
210 }
211
212
213
214 /**
215 * {@inheritDoc}
216 */
217 @Override()
218 public ASN1OctetString normalize(final ASN1OctetString value)
219 {
220 return value;
221 }
222
223
224
225 /**
226 * {@inheritDoc}
227 */
228 @Override()
229 public ASN1OctetString normalizeSubstring(final ASN1OctetString value,
230 final byte substringType)
231 {
232 return value;
233 }
234 }