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