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