001 /*
002 * Copyright 2008-2014 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2008-2014 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
027 import static com.unboundid.util.StaticUtils.*;
028
029
030
031 /**
032 * This class provides an implementation of a matching rule that performs
033 * byte-for-byte matching.
034 */
035 public final class OctetStringMatchingRule
036 extends AcceptAllSimpleMatchingRule
037 {
038 /**
039 * The singleton instance that will be returned from the {@code getInstance}
040 * method.
041 */
042 private static final OctetStringMatchingRule INSTANCE =
043 new OctetStringMatchingRule();
044
045
046
047 /**
048 * The name for the octetStringMatch equality matching rule.
049 */
050 public static final String EQUALITY_RULE_NAME = "octetStringMatch";
051
052
053
054 /**
055 * The name for the octetStringMatch equality matching rule, formatted in all
056 * lowercase characters.
057 */
058 static final String LOWER_EQUALITY_RULE_NAME =
059 toLowerCase(EQUALITY_RULE_NAME);
060
061
062
063 /**
064 * The OID for the octetStringMatch equality matching rule.
065 */
066 public static final String EQUALITY_RULE_OID = "2.5.13.17";
067
068
069
070 /**
071 * The name for the octetStringOrderingMatch ordering matching rule.
072 */
073 public static final String ORDERING_RULE_NAME = "octetStringOrderingMatch";
074
075
076
077 /**
078 * The name for the octetStringOrderingMatch ordering matching rule, formatted
079 * in all lowercase characters.
080 */
081 static final String LOWER_ORDERING_RULE_NAME =
082 toLowerCase(ORDERING_RULE_NAME);
083
084
085
086 /**
087 * The OID for the octetStringOrderingMatch ordering matching rule.
088 */
089 public static final String ORDERING_RULE_OID = "2.5.13.18";
090
091
092
093 /**
094 * The name for the octetStringSubstringsMatch substring matching rule.
095 */
096 public static final String SUBSTRING_RULE_NAME = "octetStringSubstringsMatch";
097
098
099
100 /**
101 * The name for the octetStringSubstringsMatch substring matching rule,
102 * formatted in all lowercase characters.
103 */
104 static final String LOWER_SUBSTRING_RULE_NAME =
105 toLowerCase(SUBSTRING_RULE_NAME);
106
107
108
109 /**
110 * The OID for the octetStringSubstringMatch substring matching rule.
111 */
112 public static final String SUBSTRING_RULE_OID = "2.5.13.19";
113
114
115
116 /**
117 * The serial version UID for this serializable class.
118 */
119 private static final long serialVersionUID = -5655018388491186342L;
120
121
122
123 /**
124 * Creates a new instance of this octet string matching rule.
125 */
126 public OctetStringMatchingRule()
127 {
128 // No implementation is required.
129 }
130
131
132
133 /**
134 * Retrieves a singleton instance of this matching rule.
135 *
136 * @return A singleton instance of this matching rule.
137 */
138 public static OctetStringMatchingRule getInstance()
139 {
140 return INSTANCE;
141 }
142
143
144
145 /**
146 * {@inheritDoc}
147 */
148 @Override()
149 public String getEqualityMatchingRuleName()
150 {
151 return EQUALITY_RULE_NAME;
152 }
153
154
155
156 /**
157 * {@inheritDoc}
158 */
159 @Override()
160 public String getEqualityMatchingRuleOID()
161 {
162 return EQUALITY_RULE_OID;
163 }
164
165
166
167 /**
168 * {@inheritDoc}
169 */
170 @Override()
171 public String getOrderingMatchingRuleName()
172 {
173 return ORDERING_RULE_NAME;
174 }
175
176
177
178 /**
179 * {@inheritDoc}
180 */
181 @Override()
182 public String getOrderingMatchingRuleOID()
183 {
184 return ORDERING_RULE_OID;
185 }
186
187
188
189 /**
190 * {@inheritDoc}
191 */
192 @Override()
193 public String getSubstringMatchingRuleName()
194 {
195 return SUBSTRING_RULE_NAME;
196 }
197
198
199
200 /**
201 * {@inheritDoc}
202 */
203 @Override()
204 public String getSubstringMatchingRuleOID()
205 {
206 return SUBSTRING_RULE_OID;
207 }
208
209
210
211 /**
212 * {@inheritDoc}
213 */
214 @Override()
215 public ASN1OctetString normalize(final ASN1OctetString value)
216 {
217 return value;
218 }
219
220
221
222 /**
223 * {@inheritDoc}
224 */
225 @Override()
226 public ASN1OctetString normalizeSubstring(final ASN1OctetString value,
227 final byte substringType)
228 {
229 return value;
230 }
231 }