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