001/* 002 * CDDL HEADER START 003 * 004 * The contents of this file are subject to the terms of the 005 * Common Development and Distribution License, Version 1.0 only 006 * (the "License"). You may not use this file except in compliance 007 * with the License. 008 * 009 * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt 010 * or http://forgerock.org/license/CDDLv1.0.html. 011 * See the License for the specific language governing permissions 012 * and limitations under the License. 013 * 014 * When distributing Covered Code, include this CDDL HEADER in each 015 * file and include the License file at legal-notices/CDDLv1_0.txt. 016 * If applicable, add the following below this CDDL HEADER, with the 017 * fields enclosed by brackets "[]" replaced with your own identifying 018 * information: 019 * Portions Copyright [yyyy] [name of copyright owner] 020 * 021 * CDDL HEADER END 022 * 023 * 024 * Copyright 2009 Sun Microsystems, Inc. 025 */ 026 027package org.forgerock.opendj.ldap.schema; 028 029import org.forgerock.i18n.LocalizableMessageBuilder; 030import org.forgerock.opendj.ldap.ByteSequence; 031 032/** 033 * This interface defines the set of methods and structures that must be 034 * implemented to define a new attribute syntax. 035 */ 036public interface SyntaxImpl { 037 /** 038 * Retrieves the default approximate matching rule that will be used for 039 * attributes with this syntax. 040 * 041 * @return The default approximate matching rule that will be used for 042 * attributes with this syntax, or {@code null} if approximate 043 * matches will not be allowed for this type by default. 044 */ 045 String getApproximateMatchingRule(); 046 047 /** 048 * Retrieves the default equality matching rule that will be used for 049 * attributes with this syntax. 050 * 051 * @return The default equality matching rule that will be used for 052 * attributes with this syntax, or {@code null} if equality matches 053 * will not be allowed for this type by default. 054 */ 055 String getEqualityMatchingRule(); 056 057 /** 058 * Retrieves the common name for this attribute syntax. 059 * 060 * @return The common name for this attribute syntax. 061 */ 062 String getName(); 063 064 /** 065 * Retrieves the default ordering matching rule that will be used for 066 * attributes with this syntax. 067 * 068 * @return The default ordering matching rule that will be used for 069 * attributes with this syntax, or {@code null} if ordering matches 070 * will not be allowed for this type by default. 071 */ 072 String getOrderingMatchingRule(); 073 074 /** 075 * Retrieves the default substring matching rule that will be used for 076 * attributes with this syntax. 077 * 078 * @return The default substring matching rule that will be used for 079 * attributes with this syntax, or {@code null} if substring matches 080 * will not be allowed for this type by default. 081 */ 082 String getSubstringMatchingRule(); 083 084 /** 085 * Indicates whether this attribute syntax requires that values must be 086 * encoded using the Basic Encoding Rules (BER) used by X.500 directories 087 * and always include the {@code binary} attribute description option. 088 * 089 * @return {@code true} this attribute syntax requires that values must be 090 * BER encoded and always include the {@code binary} attribute 091 * description option, or {@code false} if not. 092 * @see <a href="http://tools.ietf.org/html/rfc4522">RFC 4522 - Lightweight 093 * Directory Access Protocol (LDAP): The Binary Encoding Option </a> 094 */ 095 boolean isBEREncodingRequired(); 096 097 /** 098 * Indicates whether this attribute syntax would likely be a human readable 099 * string. 100 * 101 * @return {@code true} if this attribute syntax would likely be a human 102 * readable string or {@code false} if not. 103 */ 104 boolean isHumanReadable(); 105 106 /** 107 * Indicates whether the provided value is acceptable for use in an 108 * attribute with this syntax. If it is not, then the reason may be appended 109 * to the provided buffer. 110 * 111 * @param schema 112 * The schema in which this syntax is defined. 113 * @param value 114 * The value for which to make the determination. 115 * @param invalidReason 116 * The buffer to which the invalid reason should be appended. 117 * @return {@code true} if the provided value is acceptable for use with 118 * this syntax, or {@code false} if not. 119 */ 120 boolean valueIsAcceptable(Schema schema, ByteSequence value, 121 LocalizableMessageBuilder invalidReason); 122}