OPENDJ-1307 Migrate server ASN1 classes to SDK
ASN1 classes logging is throwing an UnsupportedOperationException while being used in the server. This exception is thrown by OpenDJLoggerAdapter from the opendj-slf4j-adapter in use in the server.
Changed OpenDJ SDK to use LocalizedLogger instead of raw slf4j-api (at least for IO category).
More work remains to switch all OpenDJ SDK to use LocalizedLogger instead of raw slf4j-api.
StaticUtils.java, *.java:
Removed CONTROLS_LOG and SCHEMA_LOG + replaced every uses of it by using per class LocalizedLoggers.
| | |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.byteToHex; |
| | | import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_CONTROL_BAD_OID; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_DECODE_ERROR; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_NO_CONTROL_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ACCTUSABLERES_UNKNOWN_VALUE_ELEMENT_TYPE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.controls.Control; |
| | | import org.forgerock.opendj.ldap.controls.ControlDecoder; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * @see AccountUsabilityRequestControl |
| | | */ |
| | | public final class AccountUsabilityResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The OID for the account usability response control. |
| | | */ |
| | |
| | | throw DecodeException.error(message); |
| | | } |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_ACCTUSABLERES_DECODE_ERROR.get(getExceptionMessage(e)); |
| | |
| | | public static final Logger DEFAULT_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME); |
| | | |
| | | /** |
| | | * The logger used by the SDK for controls related features. |
| | | */ |
| | | public static final Logger CONTROLS_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME + ".controls"); |
| | | |
| | | /** |
| | | * The logger used by the SDK for schema related features. |
| | | */ |
| | | public static final Logger SCHEMA_LOG = LoggerFactory.getLogger(DEFAULT_LOGGER_NAME + ".schema"); |
| | | |
| | | /** |
| | | * Indicates whether the SDK is being used in debug mode. In debug mode |
| | | * components may enable certain instrumentation in order to help debug |
| | | * applications. |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * The entry change notification response control as defined in |
| | | * draft-ietf-ldapext-psearch. This control provides additional information |
| | |
| | | * - Persistent Search: A Simple LDAP Change Notification Mechanism </a> |
| | | */ |
| | | public final class EntryChangeNotificationResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the entry change notification response control. |
| | | */ |
| | |
| | | changeNumber = reader.readInteger(); |
| | | } |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_ECN_CANNOT_DECODE_VALUE.get(getExceptionMessage(e)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.Filter; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * The matched values request control as defined in RFC 3876. The matched values |
| | | * control may be included in a search request to indicate that only attribute |
| | |
| | | } |
| | | } |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The OID for the matched values request control used to specify which |
| | | * particular attribute values should be returned in a search result entry. |
| | |
| | | return new MatchedValuesRequestControl(control.isCritical(), Collections |
| | | .unmodifiableList(filters)); |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_MATCHEDVALUES_CANNOT_DECODE_VALUE_AS_SEQUENCE |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_CONTROL_BAD_OID; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PWEXPIRING_NO_CONTROL_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * - Password Policy for LDAP Directories </a> |
| | | */ |
| | | public final class PasswordExpiringResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the Netscape password expiring response control. |
| | | */ |
| | |
| | | try { |
| | | secondsUntilExpiration = Integer.parseInt(control.getValue().toString()); |
| | | } catch (final Exception e) { |
| | | StaticUtils.CONTROLS_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_PWEXPIRING_CANNOT_DECODE_SECONDS_UNTIL_EXPIRATION |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * The password policy response control as defined in |
| | | * draft-behera-ldap-password-policy. |
| | |
| | | * </a> |
| | | */ |
| | | public final class PasswordPolicyResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the password policy control from |
| | | * draft-behera-ldap-password-policy. |
| | |
| | | return new PasswordPolicyResponseControl(control.isCritical(), warningType, |
| | | warningValue, errorType); |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_PWPOLICYRES_DECODE_ERROR.get(getExceptionMessage(e)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_BAD_CHANGE_TYPES; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_CANNOT_DECODE_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_CONTROL_BAD_OID; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PSEARCH_NO_CONTROL_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * - Persistent Search: A Simple LDAP Change Notification Mechanism </a> |
| | | */ |
| | | public final class PersistentSearchRequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the persistent search request control. |
| | | */ |
| | |
| | | |
| | | reader.readEndSequence(); |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read sequence", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_PSEARCH_CANNOT_DECODE_VALUE.get(getExceptionMessage(e)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static java.util.Arrays.asList; |
| | | import static java.util.Collections.emptyList; |
| | | import static java.util.Collections.singletonList; |
| | | import static java.util.Collections.unmodifiableList; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADREQ_CANNOT_DECODE_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_POSTREADREQ_NO_CONTROL_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_POSTREAD_CONTROL_BAD_OID; |
| | | import static java.util.Collections.*; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * Directory Access Protocol (LDAP) Read Entry Controls </a> |
| | | */ |
| | | public final class PostReadRequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The IANA-assigned OID for the LDAP post-read request control used for |
| | | * retrieving an entry in the state it had immediately after an update was |
| | |
| | | } |
| | | reader.readEndSequence(); |
| | | } catch (final Exception ae) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", ae); |
| | | logger.debug(LocalizableMessage.raw("Unable to read sequence", ae)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_POSTREADREQ_CANNOT_DECODE_VALUE.get(ae.getMessage()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.LDAP; |
| | |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | import org.forgerock.opendj.ldap.Entries; |
| | | import org.forgerock.opendj.ldap.Entry; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * Directory Access Protocol (LDAP) Read Entry Controls </a> |
| | | */ |
| | | public final class PostReadResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The IANA-assigned OID for the LDAP post-read response control used for |
| | | * retrieving an entry in the state it had immediately after an update was |
| | |
| | | try { |
| | | entry = LDAP.readEntry(reader, options); |
| | | } catch (final IOException le) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read result entry ", le); |
| | | logger.debug(LocalizableMessage.raw("Unable to read result entry ", le)); |
| | | final LocalizableMessage message = |
| | | ERR_POSTREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage()); |
| | | throw DecodeException.error(message, le); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static java.util.Arrays.asList; |
| | | import static java.util.Collections.emptyList; |
| | | import static java.util.Collections.singletonList; |
| | | import static java.util.Collections.unmodifiableList; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PREREADREQ_CANNOT_DECODE_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PREREADREQ_NO_CONTROL_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_PREREAD_CONTROL_BAD_OID; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * Directory Access Protocol (LDAP) Read Entry Controls </a> |
| | | */ |
| | | public final class PreReadRequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The IANA-assigned OID for the LDAP pre-read request control used for |
| | | * retrieving an entry in the state it had immediately before an update was |
| | |
| | | } |
| | | reader.readEndSequence(); |
| | | } catch (final Exception ex) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", ex); |
| | | logger.debug(LocalizableMessage.raw("Unable to read sequence", ex)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_PREREADREQ_CANNOT_DECODE_VALUE.get(ex.getMessage()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.LDAP; |
| | |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | import org.forgerock.opendj.ldap.Entries; |
| | | import org.forgerock.opendj.ldap.Entry; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * Directory Access Protocol (LDAP) Read Entry Controls </a> |
| | | */ |
| | | public final class PreReadResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The IANA-assigned OID for the LDAP pre-read response control used for |
| | | * retrieving an entry in the state it had immediately before an update was |
| | |
| | | try { |
| | | entry = LDAP.readEntry(reader, options); |
| | | } catch (final IOException le) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read result entry", le); |
| | | logger.debug(LocalizableMessage.raw("Unable to read result entry", le)); |
| | | final LocalizableMessage message = |
| | | ERR_PREREADRESP_CANNOT_DECODE_VALUE.get(le.getMessage()); |
| | | throw DecodeException.error(message, le); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * draft-weltman-ldapv3-proxy-04 - LDAP Proxied Authorization Control </a> |
| | | */ |
| | | public final class ProxiedAuthV1RequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the proxied authorization v1 control. |
| | | */ |
| | |
| | | authorizationDNString = reader.readOctetStringAsString(); |
| | | reader.readEndSequence(); |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read sequence", e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read sequence", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_PROXYAUTH1_CANNOT_DECODE_VALUE.get(getExceptionMessage(e)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizedIllegalArgumentException; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * SASL Authorization Identities (authzId) </a> |
| | | */ |
| | | public final class ProxiedAuthV2RequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the proxied authorization v2 control. |
| | | */ |
| | |
| | | authorizationID = control.getValue().toString(); |
| | | } |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read exceptionID", e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read exceptionID", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_PROXYAUTH2_CANNOT_DECODE_VALUE.get(getExceptionMessage(e)); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static com.forgerock.opendj.util.StaticUtils.CONTROLS_LOG; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | * Extension for Simple Paged Results Manipulation </a> |
| | | */ |
| | | public final class SimplePagedResultsControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the paged results request/response control defined in RFC |
| | | * 2696. |
| | |
| | | } |
| | | |
| | | if (!control.getOID().equals(OID)) { |
| | | final LocalizableMessage message = |
| | | ERR_LDAP_PAGED_RESULTS_CONTROL_BAD_OID.get(control.getOID(), OID); |
| | | throw DecodeException.error(message); |
| | | throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_CONTROL_BAD_OID.get(control.getOID(), OID)); |
| | | } |
| | | |
| | | if (!control.hasValue()) { |
| | | // The control must always have a value. |
| | | final LocalizableMessage message = ERR_LDAP_PAGED_RESULTS_DECODE_NULL.get(); |
| | | throw DecodeException.error(message); |
| | | throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_NULL.get()); |
| | | } |
| | | |
| | | final ASN1Reader reader = ASN1.getReader(control.getValue()); |
| | | try { |
| | | reader.readStartSequence(); |
| | | } catch (final Exception e) { |
| | | CONTROLS_LOG.debug("Unable to read start sequence", e); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e)); |
| | | throw DecodeException.error(message, e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read start sequence", e)); |
| | | throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(e), e); |
| | | } |
| | | |
| | | int size; |
| | | try { |
| | | size = (int) reader.readInteger(); |
| | | } catch (final Exception e) { |
| | | CONTROLS_LOG.debug("Unable to read size", e); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_LDAP_PAGED_RESULTS_DECODE_SIZE.get(String.valueOf(e)); |
| | | throw DecodeException.error(message, e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read size", e)); |
| | | throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_SIZE.get(e), e); |
| | | } |
| | | |
| | | ByteString cookie; |
| | | try { |
| | | cookie = reader.readOctetString(); |
| | | } catch (final Exception e) { |
| | | CONTROLS_LOG.debug("Unable to read cookie", e); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE.get(String.valueOf(e)); |
| | | throw DecodeException.error(message, e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read cookie", e)); |
| | | throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_COOKIE.get(e), e); |
| | | } |
| | | |
| | | try { |
| | | reader.readEndSequence(); |
| | | } catch (final Exception e) { |
| | | CONTROLS_LOG.debug("Unable to read end sequence", e); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(String.valueOf(e)); |
| | | throw DecodeException.error(message, e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read end sequence", e)); |
| | | throw DecodeException.error(ERR_LDAP_PAGED_RESULTS_DECODE_SEQUENCE.get(e), e); |
| | | } |
| | | |
| | | return new SimplePagedResultsControl(control.isCritical(), size, cookie); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | import java.io.IOException; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.io.ASN1; |
| | | import org.forgerock.opendj.io.ASN1Reader; |
| | | import org.forgerock.opendj.io.ASN1Writer; |
| | |
| | | import org.forgerock.opendj.ldap.ByteStringBuilder; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | |
| | | * the Lightweight Directory Access Protocol </a> |
| | | */ |
| | | public final class SubentriesRequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the sub-entries request control. |
| | | */ |
| | |
| | | try { |
| | | visibility = reader.readBoolean(); |
| | | } catch (final IOException e) { |
| | | StaticUtils.CONTROLS_LOG.debug("Unable to read visbility", e); |
| | | logger.debug(LocalizableMessage.raw("Unable to read visbility", e)); |
| | | final LocalizableMessage message = |
| | | ERR_SUBENTRIES_CANNOT_DECODE_VALUE.get(getExceptionMessage(e)); |
| | | throw DecodeException.error(message); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_ATTRIBUTE_TYPE_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class AttributeTypeSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_ATTRTYPE_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | ERR_ATTR_SYNTAX_ATTRTYPE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader |
| | | .pos() - 1), String.valueOf(c)); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | WARN_ATTR_SYNTAX_ATTRTYPE_INVALID_ATTRIBUTE_USAGE1.get(definition, |
| | | usageStr); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } else if (tokenName.matches("^X-[A-Za-z_-]+$")) { |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_ATTRTYPE_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_DCR_INVALID1; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_CONTENT_RULE_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class DITContentRuleSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | // whitespace. That is illegal. |
| | | final LocalizableMessage message = ERR_ATTR_SYNTAX_DCR_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final char c = reader.read(); |
| | | if (c != '(') { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition, |
| | | (reader.pos() - 1), String.valueOf(c)); |
| | | ERR_ATTR_SYNTAX_DCR_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_DCR_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_INTEGER_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_DIT_STRUCTURE_RULE_NAME; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import com.forgerock.opendj.util.SubstringReader; |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class DITStructureRuleSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_INTEGER_FIRST_COMPONENT_OID; |
| | |
| | | // whitespace. That is illegal. |
| | | final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final char c = reader.read(); |
| | | if (c != '(') { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition, |
| | | (reader.pos() - 1), String.valueOf(c)); |
| | | ERR_ATTR_SYNTAX_DSR_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_DSR_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | if (nameForm == null) { |
| | | final LocalizableMessage message = ERR_ATTR_SYNTAX_DSR_NO_NAME_FORM.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | return true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions copyright 2014 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * This class defines an approximate matching rule based on the Double Metaphone |
| | | * algorithm. The Metaphone and Double Metaphone algorithms were originally |
| | |
| | | */ |
| | | final class DoubleMetaphoneApproximateMatchingRuleImpl extends AbstractMatchingRuleImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | |
| | | |
| | | return true; |
| | | } catch (final Exception e) { |
| | | if (StaticUtils.SCHEMA_LOG.isDebugEnabled()) { |
| | | StaticUtils.SCHEMA_LOG.debug("Unable to check that '" + value + "' has substring '" + substring |
| | | + "' at position " + start, e); |
| | | } |
| | | |
| | | logger.debug(LocalizableMessage.raw( |
| | | "Unable to check that '%s' has substring '%s' at position %d: %s", value, substring, start, e)); |
| | | return false; |
| | | } |
| | | } |
| | |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_INTEGER; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * This class defines the integerMatch matching rule defined in X.520 and |
| | | * referenced in RFC 2252. |
| | | */ |
| | | final class IntegerEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) |
| | | throws DecodeException { |
| | | try { |
| | | return ByteString.valueOf(Integer.parseInt(value.toString())); |
| | | } catch (final Exception e) { |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013 ForgeRock AS |
| | | * Portions copyright 2013-2014 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EMPTY_VALUE; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_EXPECTED_OPEN_PARENTHESIS; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.Assertion; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | import com.forgerock.opendj.util.SubstringReader; |
| | | |
| | | /** |
| | |
| | | */ |
| | | final class IntegerFirstComponentEqualityMatchingRuleImpl extends AbstractMatchingRuleImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public Assertion getAssertion(final Schema schema, final ByteSequence value) |
| | | throws DecodeException { |
| | |
| | | } |
| | | }; |
| | | } catch (final Exception e) { |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | ERR_EMR_INTFIRSTCOMP_FIRST_COMPONENT_NOT_INT.get(value.toString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_INTEGER; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * This class defines the integerOrderingMatch matching rule defined in X.520 |
| | | * and referenced in RFC 4519. |
| | | */ |
| | | final class IntegerOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) |
| | | throws DecodeException { |
| | | try { |
| | | return ByteString.valueOf(Integer.parseInt(value.toString())); |
| | | } catch (final Exception e) { |
| | | StaticUtils.SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | |
| | | final LocalizableMessage message = |
| | | WARN_ATTR_SYNTAX_ILLEGAL_INTEGER.get(value.toString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_LDAP_SYNTAX_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class LDAPSyntaxDescriptionSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_ATTRSYNTAX_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final char c = reader.read(); |
| | | if (c != '(') { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition, |
| | | (reader.pos() - 1), String.valueOf(c)); |
| | | ERR_ATTR_SYNTAX_ATTRSYNTAX_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader.pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_ATTRSYNTAX_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | WARN_ATTR_SYNTAX_LDAPSYNTAX_REGEX_INVALID_PATTERN.get(oid, |
| | | pattern); |
| | | final DecodeException de = DecodeException.error(message, e); |
| | | SCHEMA_LOG.debug("", de); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw de; |
| | | } |
| | | break; |
| | |
| | | for (int j = i + 1; j < values.size(); j++) { |
| | | if (entry.equals(values.get(j))) { |
| | | final LocalizableMessage message = |
| | | WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE.get(oid, |
| | | entry, j); |
| | | WARN_ATTR_SYNTAX_LDAPSYNTAX_ENUM_DUPLICATE_VALUE.get(oid, entry, j); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class MatchingRuleSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | // whitespace. That is illegal. |
| | | final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | if (c != '(') { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_MR_EXPECTED_OPEN_PARENTHESIS.get(definition, |
| | | (reader.pos() - 1), String.valueOf(c)); |
| | | (reader.pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_MR_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | if (syntax == null) { |
| | | final LocalizableMessage message = ERR_ATTR_SYNTAX_MR_NO_SYNTAX.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | return true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_MATCHING_RULE_USE_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class MatchingRuleUseSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_MRUSE_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final char c = reader.read(); |
| | | if (c != '(') { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader |
| | | .pos() - 1), String.valueOf(c)); |
| | | ERR_ATTR_SYNTAX_MRUSE_EXPECTED_OPEN_PARENTHESIS.get(definition, |
| | | (reader.pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_MRUSE_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | if (attributes == null || attributes.size() == 0) { |
| | | final LocalizableMessage message = ERR_ATTR_SYNTAX_MRUSE_NO_ATTR.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | return true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_NAME_FORM_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class NameFormSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_NAME_FORM_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | ERR_ATTR_SYNTAX_NAME_FORM_EXPECTED_OPEN_PARENTHESIS.get(definition, (reader |
| | | .pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_NAME_FORM_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_NAME_FORM_NO_STRUCTURAL_CLASS1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | return true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_ATTR_SYNTAX_OBJECTCLASS_INVALID1; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OID_FIRST_COMPONENT_OID; |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OBJECTCLASS_NAME; |
| | | import static com.forgerock.opendj.util.StaticUtils.SCHEMA_LOG; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | |
| | | */ |
| | | final class ObjectClassSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_OBJECTCLASS_EMPTY_VALUE1.get(definition); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | if (c != '(') { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_OBJECTCLASS_EXPECTED_OPEN_PARENTHESIS1.get(definition, |
| | | (reader.pos() - 1), String.valueOf(c)); |
| | | (reader.pos() - 1), c); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | |
| | |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_OBJECTCLASS_ILLEGAL_TOKEN1.get(definition, tokenName); |
| | | final DecodeException e = DecodeException.error(message); |
| | | SCHEMA_LOG.debug("", e); |
| | | logger.debug(LocalizableMessage.raw("%s", e)); |
| | | throw e; |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS |
| | | * Portions copyright 2012-2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.*; |
| | |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | |
| | | import com.forgerock.opendj.util.StaticUtils; |
| | | |
| | | /** |
| | | * This class implements the UTC time attribute syntax. This is very similar to |
| | | * the generalized time syntax (and actually has been deprecated in favor of |
| | |
| | | */ |
| | | final class UTCTimeSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The lock that will be used to provide threadsafe access to the date |
| | | * formatter. |
| | |
| | | } |
| | | } catch (final Exception e) { |
| | | final LocalizableMessage message = |
| | | ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE.get(valueString, String.valueOf(e)); |
| | | ERR_ATTR_SYNTAX_UTC_TIME_CANNOT_PARSE.get(valueString, e); |
| | | final DecodeException de = DecodeException.error(message, e); |
| | | StaticUtils.SCHEMA_LOG.debug("", de); |
| | | logger.debug(LocalizableMessage.raw("%s", de)); |
| | | throw de; |
| | | } |
| | | } |