Added @Override annotations, removed {@inheritDoc}
old mode 100755
new mode 100644
| | |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2009 Parametric Technology Corporation (PTC) |
| | | * Portions copyright 2014 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | * @return the alias name for the desired key, or null if there are no |
| | | * matches. |
| | | */ |
| | | @Override |
| | | public String chooseClientAlias(final String[] keyType, final Principal[] issuers, |
| | | final Socket socket) { |
| | | if (keyManager != null) { |
| | |
| | | * @return the alias name for the desired key, or null if there are no |
| | | * matches. |
| | | */ |
| | | @Override |
| | | public String chooseServerAlias(final String keyType, final Principal[] issuers, final Socket socket) { |
| | | if (keyManager != null) { |
| | | return keyManager.chooseServerAlias(keyType, issuers, socket); |
| | |
| | | * and the root certificate authority last), or null if the alias |
| | | * can't be found. |
| | | */ |
| | | @Override |
| | | public X509Certificate[] getCertificateChain(final String alias) { |
| | | if (keyManager != null) { |
| | | return keyManager.getCertificateChain(alias); |
| | |
| | | * @return an array of the matching alias names, or null if there were no |
| | | * matches. |
| | | */ |
| | | @Override |
| | | public String[] getClientAliases(final String keyType, final Principal[] issuers) { |
| | | if (keyManager != null) { |
| | | return keyManager.getClientAliases(keyType, issuers); |
| | |
| | | * the alias name |
| | | * @return the requested key, or null if the alias can't be found. |
| | | */ |
| | | @Override |
| | | public PrivateKey getPrivateKey(final String alias) { |
| | | if (keyManager != null) { |
| | | return keyManager.getPrivateKey(alias); |
| | |
| | | * @return an array of the matching alias names, or null if there were no |
| | | * matches. |
| | | */ |
| | | @Override |
| | | public String[] getServerAliases(final String keyType, final Principal[] issuers) { |
| | | if (keyManager != null) { |
| | | return keyManager.getServerAliases(keyType, issuers); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2014 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | this.message = message; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getMessageObject() { |
| | | return this.message; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | * |
| | | * @return The String representation of this command builder (i.e. what we want to show to the user). |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | return toString(false, LINE_SEPARATOR); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | | import static com.forgerock.opendj.cli.CliMessages.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Collection; |
| | |
| | | this.callbacks = callbacks; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MenuResult<T> invoke(ConsoleApplication app) throws ClientException { |
| | | List<T> values = new ArrayList<>(); |
| | | for (MenuCallback<T> callback : callbacks) { |
| | |
| | | this.nMaxTries = nMaxTries; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MenuResult<T> run() throws ClientException { |
| | | // The validation call-back which will be used to determine the |
| | | // action call-back. |
| | | ValidationCallback<MenuCallback<T>> validator = new ValidationCallback<MenuCallback<T>>() { |
| | | |
| | | @Override |
| | | public MenuCallback<T> validate(ConsoleApplication app, String input) { |
| | | String ninput = input.trim(); |
| | | |
| | |
| | | this.result = result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public MenuResult<T> invoke(ConsoleApplication app) throws ClientException { |
| | | return result; |
| | | } |
| | |
| | | public void addHelpOption(final HelpCallback callback) { |
| | | MenuCallback<T> wrapper = new MenuCallback<T>() { |
| | | |
| | | @Override |
| | | public MenuResult<T> invoke(ConsoleApplication app) throws ClientException { |
| | | app.println(); |
| | | callback.display(app); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | * like to trust a server certificate. |
| | | */ |
| | | public final class PromptingTrustManager implements X509TrustManager { |
| | | /** |
| | | * Enumeration description server certificate trust option. |
| | | */ |
| | | /** Enumeration description server certificate trust option. */ |
| | | private static enum TrustOption { |
| | | UNTRUSTED(1, INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_NO.get()), |
| | | SESSION(2, INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_SESSION.get()), |
| | |
| | | CERTIFICATE_DETAILS(4, INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS.get()); |
| | | |
| | | private Integer choice; |
| | | |
| | | private LocalizableMessage msg; |
| | | |
| | | /** |
| | |
| | | this(app, DEFAULT_PATH, sourceTrustManager); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(final X509Certificate[] x509Certificates, final String s) |
| | | throws CertificateException { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(final X509Certificate[] x509Certificates, final String s) |
| | | throws CertificateException { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | if (nestedTrustManager != null) { |
| | | return nestedTrustManager.getAcceptedIssuers(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | /** The minimum number of unnamed trailing arguments that may be provided. */ |
| | | private int minTrailingArguments; |
| | | |
| | | /** |
| | | * The display name that will be used for the trailing arguments in |
| | | * the usage information. |
| | | */ |
| | | /** The display name that will be used for the trailing arguments in the usage information. */ |
| | | private String trailingArgsDisplayName; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private LocalizableMessage docDescriptionSupplement; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getDocDescriptionSupplement() { |
| | | return docDescriptionSupplement != null ? docDescriptionSupplement : LocalizableMessage.EMPTY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDocDescriptionSupplement(final LocalizableMessage docDescriptionSupplement) { |
| | | this.docDescriptionSupplement = docDescriptionSupplement; |
| | | } |
| | |
| | | this.isHidden = isHidden; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder sb = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.cli; |
| | | |
| | |
| | | List<List<String>> sortedRows = new ArrayList<>(rows); |
| | | |
| | | Comparator<List<String>> comparator = new Comparator<List<String>>() { |
| | | |
| | | @Override |
| | | public int compare(List<String> row1, List<String> row2) { |
| | | for (int i = 0; i < sortKeys.size(); i++) { |
| | | String cell1 = row1.get(sortKeys.get(i)); |
| | |
| | | // Both rows are equal. |
| | | return 0; |
| | | } |
| | | |
| | | }; |
| | | |
| | | Collections.sort(sortedRows, comparator); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2015 ForgeRock AS. |
| | | * Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.maven; |
| | | |
| | |
| | | * @throws MojoExecutionException |
| | | * if any |
| | | */ |
| | | @Override |
| | | public void execute() throws MojoFailureException, MojoExecutionException { |
| | | if (checkDisabled) { |
| | | getLog().info("Copyright check is disabled"); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package com.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * @see AccountUsabilityResponseControl |
| | | */ |
| | | public final class AccountUsabilityRequestControl implements Control { |
| | | /** |
| | | * The OID for the account usability request control. |
| | | */ |
| | | /** The OID for the account usability request control. */ |
| | | public static final String OID = "1.3.6.1.4.1.42.2.27.9.5.8"; |
| | | |
| | | private final boolean isCritical; |
| | |
| | | private static final AccountUsabilityRequestControl NONCRITICAL_INSTANCE = |
| | | new AccountUsabilityRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the account usability request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the account usability request control. */ |
| | | public static final ControlDecoder<AccountUsabilityRequestControl> DECODER = |
| | | new ControlDecoder<AccountUsabilityRequestControl>() { |
| | | |
| | | @Override |
| | | public AccountUsabilityRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The OID for the account usability response control. |
| | | */ |
| | | /** The OID for the account usability response control. */ |
| | | public static final String OID = AccountUsabilityRequestControl.OID; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the account usability response |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the account usability response control. */ |
| | | public static final ControlDecoder<AccountUsabilityResponseControl> DECODER = |
| | | new ControlDecoder<AccountUsabilityResponseControl>() { |
| | | |
| | | @Override |
| | | public AccountUsabilityResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * The BER type to use for the seconds before expiration when the account is |
| | | * available. |
| | | */ |
| | | /** The BER type to use for the seconds before expiration when the account is available. */ |
| | | private static final byte TYPE_SECONDS_BEFORE_EXPIRATION = (byte) 0x80; |
| | | |
| | | /** |
| | | * The BER type to use for the MORE_INFO sequence when the account is not |
| | | * available. |
| | | */ |
| | | /** The BER type to use for the MORE_INFO sequence when the account is not available. */ |
| | | private static final byte TYPE_MORE_INFO = (byte) 0xA1; |
| | | |
| | | /** |
| | |
| | | /** The number of remaining grace logins, if available. */ |
| | | private final int remainingGraceLogins; |
| | | |
| | | /** |
| | | * The length of time in seconds before the user's password expires, |
| | | * if available. |
| | | */ |
| | | /** The length of time in seconds before the user's password expires, if available. */ |
| | | private final int secondsBeforeExpiration; |
| | | |
| | | /** |
| | | * The length of time before the user's account is unlocked, if |
| | | * available. |
| | | */ |
| | | /** The length of time before the user's account is unlocked, if available. */ |
| | | private final int secondsBeforeUnlock; |
| | | |
| | | private final boolean isCritical; |
| | |
| | | this.secondsBeforeExpiration = secondsBeforeExpiration; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return secondsBeforeUnlock; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | |
| | | return isUsable; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package com.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * control is 2.16.840.1.113730.3.4.17, and it does not have a value. |
| | | */ |
| | | public final class RealAttributesOnlyRequestControl implements Control { |
| | | /** |
| | | * The OID for the real attributes only request control. |
| | | */ |
| | | /** The OID for the real attributes only request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.17"; |
| | | |
| | | private static final RealAttributesOnlyRequestControl CRITICAL_INSTANCE = |
| | |
| | | private static final RealAttributesOnlyRequestControl NONCRITICAL_INSTANCE = |
| | | new RealAttributesOnlyRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the real attributes only request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the real attributes only request control. */ |
| | | public static final ControlDecoder<RealAttributesOnlyRequestControl> DECODER = |
| | | new ControlDecoder<RealAttributesOnlyRequestControl>() { |
| | | |
| | | @Override |
| | | public RealAttributesOnlyRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package com.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * control is 2.16.840.1.113730.3.4.19, and it does not have a value. |
| | | */ |
| | | public final class VirtualAttributesOnlyRequestControl implements Control { |
| | | /** |
| | | * The OID for the virtual attributes only request control. |
| | | */ |
| | | /** The OID for the virtual attributes only request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.19"; |
| | | |
| | | private static final VirtualAttributesOnlyRequestControl CRITICAL_INSTANCE = |
| | |
| | | private static final VirtualAttributesOnlyRequestControl NONCRITICAL_INSTANCE = |
| | | new VirtualAttributesOnlyRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the virtual attributes only |
| | | * request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the virtual attributes only request control. */ |
| | | public static final ControlDecoder<VirtualAttributesOnlyRequestControl> DECODER = |
| | | new ControlDecoder<VirtualAttributesOnlyRequestControl>() { |
| | | |
| | | @Override |
| | | public VirtualAttributesOnlyRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | private static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<GetConnectionIDExtendedRequest, GetConnectionIDExtendedResult> { |
| | | |
| | | @Override |
| | | public GetConnectionIDExtendedRequest decodeExtendedRequest( |
| | | final ExtendedRequest<?> request, final DecodeOptions options) |
| | | throws DecodeException { |
| | |
| | | |
| | | private static final class ResultDecoder extends |
| | | AbstractExtendedResultDecoder<GetConnectionIDExtendedResult> { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GetConnectionIDExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | if (!resultCode.isExceptional()) { |
| | |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public GetConnectionIDExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | if (result instanceof GetConnectionIDExtendedResult) { |
| | |
| | | private static final GetConnectionIDExtendedRequest INSTANCE = |
| | | new GetConnectionIDExtendedRequest(); |
| | | |
| | | /** |
| | | * A decoder which can be used to decode get connection ID extended |
| | | * operation requests. |
| | | */ |
| | | /** A decoder which can be used to decode get connection ID extended operation requests. */ |
| | | public static final RequestDecoder REQUEST_DECODER = new RequestDecoder(); |
| | | |
| | | /** No need to expose this. */ |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ExtendedResultDecoder<GetConnectionIDExtendedResult> getResultDecoder() { |
| | | return RESULT_DECODER; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013-2014 ForgeRock AS |
| | | * Portions copyright 2013-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.ldap.extensions; |
| | | |
| | |
| | | private static final class RequestDecoder implements |
| | | ExtendedRequestDecoder<GetSymmetricKeyExtendedRequest, ExtendedResult> { |
| | | |
| | | @Override |
| | | public GetSymmetricKeyExtendedRequest decodeExtendedRequest( |
| | | final ExtendedRequest<?> request, final DecodeOptions options) |
| | | throws DecodeException { |
| | |
| | | |
| | | private static final class ResultDecoder extends AbstractExtendedResultDecoder<ExtendedResult> { |
| | | |
| | | @Override |
| | | public ExtendedResult newExtendedErrorResult(final ResultCode resultCode, |
| | | final String matchedDN, final String diagnosticMessage) { |
| | | return Responses.newGenericExtendedResult(resultCode).setMatchedDN(matchedDN) |
| | | .setDiagnosticMessage(diagnosticMessage); |
| | | } |
| | | |
| | | @Override |
| | | public ExtendedResult decodeExtendedResult(final ExtendedResult result, |
| | | final DecodeOptions options) throws DecodeException { |
| | | return result; |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package com.forgerock.opendj.ldap.extensions; |
| | |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.responses.AbstractExtendedResult; |
| | | |
| | | /** |
| | | * The password policy state extended result. |
| | | */ |
| | | /** The password policy state extended result. */ |
| | | public final class PasswordPolicyStateExtendedResult extends |
| | | AbstractExtendedResult<PasswordPolicyStateExtendedResult> implements |
| | | PasswordPolicyStateOperationContainer { |
| | |
| | | super(resultCode); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void addOperation(final PasswordPolicyStateOperation operation) { |
| | | operations.add(operation); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | // No response name defined. |
| | | return PasswordPolicyStateExtendedRequest.OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Iterable<PasswordPolicyStateOperation> getOperations() { |
| | | return operations; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getTargetUser() { |
| | | return targetUser; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return PasswordPolicyStateExtendedRequest.encode(targetUser, operations); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setTargetUser(String targetUser) { |
| | | this.targetUser = targetUser != null ? targetUser : ""; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package com.forgerock.opendj.ldap.extensions; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | |
| | | /** |
| | | * Password policy state operation type. |
| | | */ |
| | | /** Password policy state operation type. */ |
| | | public enum PasswordPolicyStateOperationType implements PasswordPolicyStateOperation { |
| | | /** |
| | | * Get password policy DN operation. |
| | | */ |
| | | /** Get password policy DN operation. */ |
| | | GET_PASSWORD_POLICY_DN(PasswordPolicyStateExtendedRequest.PASSWORD_POLICY_DN_NAME), |
| | | |
| | | /** |
| | | * Get account disabled state operation. |
| | | */ |
| | | /** Get account disabled state operation. */ |
| | | GET_ACCOUNT_DISABLED_STATE(PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME), |
| | | |
| | | /** |
| | | * Set account disabled state operation. |
| | | */ |
| | | /** Set account disabled state operation. */ |
| | | SET_ACCOUNT_DISABLED_STATE(PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME), |
| | | |
| | | /** |
| | | * Clear account disabled state operation. |
| | | */ |
| | | /** Clear account disabled state operation. */ |
| | | CLEAR_ACCOUNT_DISABLED_STATE(PasswordPolicyStateExtendedRequest.ACCOUNT_DISABLED_STATE_NAME), |
| | | |
| | | /** |
| | | * Get account expiration time operation. |
| | | */ |
| | | /** Get account expiration time operation. */ |
| | | GET_ACCOUNT_EXPIRATION_TIME(PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME), |
| | | |
| | | /** |
| | | * Set account expiration time operation. |
| | | */ |
| | | /** Set account expiration time operation. */ |
| | | SET_ACCOUNT_EXPIRATION_TIME(PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME), |
| | | |
| | | /** |
| | | * Clear account expiration time operation. |
| | | */ |
| | | /** Clear account expiration time operation. */ |
| | | CLEAR_ACCOUNT_EXPIRATION_TIME(PasswordPolicyStateExtendedRequest.ACCOUNT_EXPIRATION_TIME_NAME), |
| | | |
| | | /** |
| | | * Get seconds until account expiration operation. |
| | | */ |
| | | /** Get seconds until account expiration operation. */ |
| | | GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_ACCOUNT_EXPIRATION_NAME), |
| | | |
| | | /** |
| | | * Get password changed time operation. |
| | | */ |
| | | /** Get password changed time operation. */ |
| | | GET_PASSWORD_CHANGED_TIME(PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME), |
| | | |
| | | /** |
| | | * Set password changed time operation. |
| | | */ |
| | | /** Set password changed time operation. */ |
| | | SET_PASSWORD_CHANGED_TIME(PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME), |
| | | |
| | | /** |
| | | * Clear password changed time operation. |
| | | */ |
| | | /** Clear password changed time operation. */ |
| | | CLEAR_PASSWORD_CHANGED_TIME(PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_TIME_NAME), |
| | | |
| | | /** |
| | | * Get password expiration warned time operation. |
| | | */ |
| | | /** Get password expiration warned time operation. */ |
| | | GET_PASSWORD_EXPIRATION_WARNED_TIME( |
| | | PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME), |
| | | |
| | | /** |
| | | * Set password expiration warned time operation. |
| | | */ |
| | | /** Set password expiration warned time operation. */ |
| | | SET_PASSWORD_EXPIRATION_WARNED_TIME( |
| | | PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME), |
| | | |
| | | /** |
| | | * Clear password expiration warned time operation. |
| | | */ |
| | | /** Clear password expiration warned time operation. */ |
| | | CLEAR_PASSWORD_EXPIRATION_WARNED_TIME( |
| | | PasswordPolicyStateExtendedRequest.PASSWORD_EXPIRATION_WARNED_TIME_NAME), |
| | | |
| | | /** |
| | | * Get seconds until password expiration operation. |
| | | */ |
| | | /** Get seconds until password expiration operation. */ |
| | | GET_SECONDS_UNTIL_PASSWORD_EXPIRATION( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_EXPIRATION_NAME), |
| | | |
| | | /** |
| | | * Get seconds until password expiration warning operation. |
| | | */ |
| | | /** Get seconds until password expiration warning operation. */ |
| | | GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING_NAME), |
| | | |
| | | /** |
| | | * Get authentication failure times operation. |
| | | */ |
| | | /** Get authentication failure times operation. */ |
| | | GET_AUTHENTICATION_FAILURE_TIMES( |
| | | PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Add authentication failure times operation. |
| | | */ |
| | | /** Add authentication failure times operation. */ |
| | | ADD_AUTHENTICATION_FAILURE_TIMES( |
| | | PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Set authentication failure times operation. |
| | | */ |
| | | /** Set authentication failure times operation. */ |
| | | SET_AUTHENTICATION_FAILURE_TIMES( |
| | | PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Clear authentication failure times operation. |
| | | */ |
| | | /** Clear authentication failure times operation. */ |
| | | CLEAR_AUTHENTICATION_FAILURE_TIMES( |
| | | PasswordPolicyStateExtendedRequest.AUTHENTICATION_FAILURE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Get seconds until authentication failure unlock operation. |
| | | */ |
| | | /** Get seconds until authentication failure unlock operation. */ |
| | | GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK_NAME), |
| | | |
| | | /** |
| | | * Get remaining authentication failure count operation. |
| | | */ |
| | | /** Get remaining authentication failure count operation. */ |
| | | GET_REMAINING_AUTHENTICATION_FAILURE_COUNT( |
| | | PasswordPolicyStateExtendedRequest.REMAINING_AUTHENTICATION_FAILURE_COUNT_NAME), |
| | | |
| | | /** |
| | | * Get last login time operation. |
| | | */ |
| | | /** Get last login time operation. */ |
| | | GET_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME), |
| | | |
| | | /** |
| | | * Set last login time operation. |
| | | */ |
| | | /** Set last login time operation. */ |
| | | SET_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME), |
| | | |
| | | /** |
| | | * Clear last login time operation. |
| | | */ |
| | | /** Clear last login time operation. */ |
| | | CLEAR_LAST_LOGIN_TIME(PasswordPolicyStateExtendedRequest.LAST_LOGIN_TIME_NAME), |
| | | |
| | | /** |
| | | * Get seconds until idle lockout operation. |
| | | */ |
| | | /** Get seconds until idle lockout operation. */ |
| | | GET_SECONDS_UNTIL_IDLE_LOCKOUT( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_IDLE_LOCKOUT_NAME), |
| | | |
| | | /** |
| | | * Get password reset state operation. |
| | | */ |
| | | /** Get password reset state operation. */ |
| | | GET_PASSWORD_RESET_STATE(PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME), |
| | | |
| | | /** |
| | | * Set password reset state operation. |
| | | */ |
| | | /** Set password reset state operation. */ |
| | | SET_PASSWORD_RESET_STATE(PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME), |
| | | |
| | | /** |
| | | * Clear password reset state operation. |
| | | */ |
| | | /** Clear password reset state operation. */ |
| | | CLEAR_PASSWORD_RESET_STATE(PasswordPolicyStateExtendedRequest.PASSWORD_RESET_STATE_NAME), |
| | | |
| | | /** |
| | | * Get seconds until password reset lockout operation. |
| | | */ |
| | | /** Get seconds until password reset lockout operation. */ |
| | | GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT_NAME), |
| | | |
| | | /** |
| | | * Get grace login use times operation. |
| | | */ |
| | | /** Get grace login use times operation. */ |
| | | GET_GRACE_LOGIN_USE_TIMES(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Add grace login use times operation. |
| | | */ |
| | | /** Add grace login use times operation. */ |
| | | ADD_GRACE_LOGIN_USE_TIME(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Set grace login use times operation. |
| | | */ |
| | | /** Set grace login use times operation. */ |
| | | SET_GRACE_LOGIN_USE_TIMES(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Clear grace login use times operation. |
| | | */ |
| | | /** Clear grace login use times operation. */ |
| | | CLEAR_GRACE_LOGIN_USE_TIMES(PasswordPolicyStateExtendedRequest.GRACE_LOGIN_USE_TIMES_NAME), |
| | | |
| | | /** |
| | | * Get remaining grace login count operation. |
| | | */ |
| | | /** Get remaining grace login count operation. */ |
| | | GET_REMAINING_GRACE_LOGIN_COUNT( |
| | | PasswordPolicyStateExtendedRequest.REMAINING_GRACE_LOGIN_COUNT_NAME), |
| | | |
| | | /** |
| | | * Get password changed by required time operation. |
| | | */ |
| | | /** Get password changed by required time operation. */ |
| | | GET_PASSWORD_CHANGED_BY_REQUIRED_TIME( |
| | | PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME), |
| | | |
| | | /** |
| | | * Set password changed by required time operation. |
| | | */ |
| | | /** Set password changed by required time operation. */ |
| | | SET_PASSWORD_CHANGED_BY_REQUIRED_TIME( |
| | | PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME), |
| | | |
| | | /** |
| | | * Clear password changed by required time operation. |
| | | */ |
| | | /** Clear password changed by required time operation. */ |
| | | CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME( |
| | | PasswordPolicyStateExtendedRequest.PASSWORD_CHANGED_BY_REQUIRED_TIME_NAME), |
| | | |
| | | /** |
| | | * Get seconds until required change time operation. |
| | | */ |
| | | /** Get seconds until required change time operation. */ |
| | | GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME( |
| | | PasswordPolicyStateExtendedRequest.SECONDS_UNTIL_REQUIRED_CHANGE_TIME_NAME), |
| | | |
| | | /** |
| | | * Get password history operation. |
| | | */ |
| | | /** Get password history operation. */ |
| | | GET_PASSWORD_HISTORY(PasswordPolicyStateExtendedRequest.PASSWORD_HISTORY_NAME), |
| | | |
| | | /** |
| | | * Clear password history operation. |
| | | */ |
| | | /** Clear password history operation. */ |
| | | CLEAR_PASSWORD_HISTORY(PasswordPolicyStateExtendedRequest.PASSWORD_HISTORY_NAME); |
| | | |
| | | private String propertyName; |
| | |
| | | this.propertyName = propertyName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PasswordPolicyStateOperationType getOperationType() { |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Iterable<ByteString> getValues() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | return propertyName; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package com.forgerock.opendj.util; |
| | |
| | | return c; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compareTo(final ASCIICharProp o) { |
| | | return c - o.c; |
| | | } |
| | |
| | | return decimalValue; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(final Object obj) { |
| | | return this == obj; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() { |
| | | return c; |
| | |
| | | return lowerCaseChar; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | return stringValue; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package com.forgerock.opendj.util; |
| | | |
| | | import java.util.Iterator; |
| | |
| | | import org.forgerock.util.Function; |
| | | import org.forgerock.util.promise.NeverThrowsException; |
| | | |
| | | /** |
| | | * Utility methods for manipulating {@link Iterator}s. |
| | | */ |
| | | /** Utility methods for manipulating {@link Iterator}s. */ |
| | | public final class Iterators { |
| | | private static final class ArrayIterator<M> implements Iterator<M> { |
| | | private int i; |
| | |
| | | this.a = a; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() { |
| | | return i < a.length; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public M next() { |
| | | if (hasNext()) { |
| | | return a[i++]; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | |
| | | } |
| | | |
| | | private static final class EmptyIterator<M> implements Iterator<M> { |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public M next() { |
| | | throw new NoSuchElementException(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | |
| | | this.parameter = p; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() { |
| | | if (hasNextMustIterate) { |
| | | hasNextMustIterate = false; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public M next() { |
| | | if (!hasNext()) { |
| | | throw new NoSuchElementException(); |
| | |
| | | return next; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() { |
| | | iterator.remove(); |
| | | } |
| | |
| | | this.value = value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() { |
| | | return value != null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public M next() { |
| | | if (value != null) { |
| | | final M tmp = value; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | |
| | | this.function = function; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() { |
| | | return iterator.hasNext(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public N next() { |
| | | return function.apply(iterator.next()); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() { |
| | | iterator.remove(); |
| | | } |
| | |
| | | this.iterator = iterator; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNext() { |
| | | return iterator.hasNext(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public M next() { |
| | | return iterator.next(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void remove() { |
| | | throw new UnsupportedOperationException(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package com.forgerock.opendj.util; |
| | | |
| | |
| | | * |
| | | * @return The human-readable name for this operating system. |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | return osName; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.io; |
| | | |
| | |
| | | |
| | | import com.forgerock.opendj.util.SizeLimitInputStream; |
| | | |
| | | /** |
| | | * An ASN1Reader that reads from an input stream. |
| | | */ |
| | | /** An ASN1Reader that reads from an input stream. */ |
| | | final class ASN1InputStreamReader extends AbstractASN1Reader { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | this.maxElementSize = maxElementSize; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() throws IOException { |
| | | // Calling close of SizeLimitInputStream should close the parent stream. |
| | | in.close(); |
| | | streamStack.clear(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean elementAvailable() throws IOException { |
| | | return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(false, false)) |
| | | && (state != ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE || needFirstLengthByteState(false, false)) |
| | |
| | | && peekLength <= in.available(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasNextElement() throws IOException { |
| | | if (!streamStack.isEmpty()) { |
| | | // We are reading a sub sequence. Return true as long as we |
| | |
| | | return state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true, false); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int peekLength() throws IOException { |
| | | peekType(); |
| | | switch (state) { |
| | |
| | | return peekLength; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public byte peekType() throws IOException { |
| | | if (state == ASN1.ELEMENT_READ_STATE_NEED_TYPE) { |
| | | needTypeState(true, true); |
| | |
| | | return peekType; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean readBoolean() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return readByte != 0x00; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readEndSequence() throws IOException { |
| | | if (streamStack.isEmpty()) { |
| | | final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED.get(); |
| | |
| | | state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readEndExplicitTag() throws DecodeException, IOException { |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readEndSet() throws IOException { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int readEnumerated() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return (int) readInteger(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long readInteger() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readNull() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString readOctetString() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return ByteString.wrap(value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return builder; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String readOctetStringAsString() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return str; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSequence() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartExplicitTag() throws DecodeException, IOException { |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSet() throws IOException { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Reader skipElement() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | * Portions Copyright 2014 Manuel Gaupp |
| | | */ |
| | | |
| | |
| | | * @throws IOException |
| | | * If an error occurs while closing. |
| | | */ |
| | | @Override |
| | | void close() throws IOException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.io; |
| | | |
| | |
| | | * @throws IOException |
| | | * If an error occurs while closing. |
| | | */ |
| | | @Override |
| | | void close() throws IOException; |
| | | |
| | | /** |
| | |
| | | * @throws IOException |
| | | * If an error occurs while flushing. |
| | | */ |
| | | @Override |
| | | void flush() throws IOException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | * Portions Copyright 2014 Manuel Gaupp |
| | | */ |
| | | |
| | |
| | | * implementing new ASN1 reader implementations. |
| | | */ |
| | | public abstract class AbstractASN1Reader implements ASN1Reader { |
| | | /** |
| | | * Creates a new abstract ASN.1 reader. |
| | | */ |
| | | /** Creates a new abstract ASN.1 reader. */ |
| | | protected AbstractASN1Reader() { |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean readBoolean(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = ASN1.UNIVERSAL_BOOLEAN_TYPE; |
| | |
| | | return readBoolean(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int readEnumerated(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = ASN1.UNIVERSAL_ENUMERATED_TYPE; |
| | |
| | | return readEnumerated(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long readInteger(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = ASN1.UNIVERSAL_INTEGER_TYPE; |
| | |
| | | return readInteger(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readNull(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = ASN1.UNIVERSAL_NULL_TYPE; |
| | |
| | | readNull(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString readOctetString(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = ASN1.UNIVERSAL_OCTET_STRING_TYPE; |
| | |
| | | return readOctetString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteStringBuilder readOctetString(byte type, final ByteStringBuilder builder) |
| | | throws IOException { |
| | | if (type == 0x00) { |
| | |
| | | return builder; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String readOctetStringAsString(byte type) throws IOException { |
| | | // We could cache the UTF-8 CharSet if performance proves to be an |
| | | // issue. |
| | |
| | | return readOctetStringAsString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartExplicitTag(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = (ASN1.TYPE_MASK_CONTEXT | ASN1.TYPE_MASK_CONSTRUCTED); |
| | |
| | | readStartExplicitTag(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSequence(byte type) throws IOException { |
| | | if (type == 0x00) { |
| | | type = ASN1.UNIVERSAL_SEQUENCE_TYPE; |
| | |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSet(byte type) throws IOException { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | |
| | | readStartSet(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Reader skipElement(final byte expectedType) throws IOException { |
| | | if (peekType() != expectedType) { |
| | | final LocalizableMessage message = |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.io; |
| | | |
| | |
| | | */ |
| | | public abstract class AbstractASN1Writer implements ASN1Writer { |
| | | |
| | | /** |
| | | * Creates a new abstract ASN.1 writer. |
| | | */ |
| | | /** Creates a new abstract ASN.1 writer. */ |
| | | protected AbstractASN1Writer() { |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeBoolean(final boolean value) throws IOException { |
| | | return writeBoolean(ASN1.UNIVERSAL_BOOLEAN_TYPE, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeEnumerated(final int value) throws IOException { |
| | | return writeEnumerated(ASN1.UNIVERSAL_ENUMERATED_TYPE, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeInteger(final int value) throws IOException { |
| | | return writeInteger(ASN1.UNIVERSAL_INTEGER_TYPE, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeInteger(final long value) throws IOException { |
| | | return writeInteger(ASN1.UNIVERSAL_INTEGER_TYPE, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeNull() throws IOException { |
| | | return writeNull(ASN1.UNIVERSAL_NULL_TYPE); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(byte type, byte[] value) throws IOException { |
| | | return writeOctetString(type, value, 0, value.length); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(byte[] value) throws IOException { |
| | | return writeOctetString(value, 0, value.length); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(final byte[] value, final int offset, final int length) |
| | | throws IOException { |
| | | return writeOctetString(ASN1.UNIVERSAL_OCTET_STRING_TYPE, value, offset, length); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(final ByteSequence value) throws IOException { |
| | | return writeOctetString(ASN1.UNIVERSAL_OCTET_STRING_TYPE, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(final String value) throws IOException { |
| | | return writeOctetString(ASN1.UNIVERSAL_OCTET_STRING_TYPE, value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeStartSequence() throws IOException { |
| | | return writeStartSequence(ASN1.UNIVERSAL_SEQUENCE_TYPE); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeStartSet() throws IOException { |
| | | return writeStartSet(ASN1.UNIVERSAL_SET_TYPE); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | | import java.util.AbstractSet; |
| | |
| | | return builder.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Sole constructor. |
| | | */ |
| | | /** Sole constructor. */ |
| | | protected AbstractAttribute() { |
| | | // No implementation required. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract boolean add(ByteString value); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean add(final Object... values) { |
| | | Reject.ifNull(values); |
| | | boolean modified = false; |
| | |
| | | return modified; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean addAll(final Collection<? extends ByteString> values) { |
| | | return addAll(values, null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> boolean addAll(final Collection<T> values, |
| | | final Collection<? super T> duplicateValues) { |
| | | boolean modified = false; |
| | |
| | | return modified; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract boolean contains(Object value); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean containsAll(final Collection<?> values) { |
| | | for (final Object value : values) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean equals(final Object object) { |
| | | return equals(this, object); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString firstValue() { |
| | | return iterator().next(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String firstValueAsString() { |
| | | return firstValue().toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract AttributeDescription getAttributeDescription(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getAttributeDescriptionAsString() { |
| | | return getAttributeDescription().toString(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int hashCode() { |
| | | return hashCode(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AttributeParser parse() { |
| | | return AttributeParser.parseAttribute(this); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract Iterator<ByteString> iterator(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract boolean remove(Object value); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean removeAll(final Collection<?> values) { |
| | | return removeAll(values, null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> boolean removeAll(final Collection<T> values, |
| | | final Collection<? super T> missingValues) { |
| | | boolean modified = false; |
| | |
| | | return modified; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean retainAll(final Collection<?> values) { |
| | | return retainAll(values, null); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public <T> boolean retainAll(final Collection<T> values, |
| | | final Collection<? super T> missingValues) { |
| | | if (values.isEmpty()) { |
| | |
| | | return modified; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public abstract int size(); |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString[] toArray() { |
| | | return toArray(new ByteString[size()]); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | return toString(this); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitAndFilter(final P p, final List<Filter> subFilters) { |
| | | return visitDefaultFilter(p); |
| | | } |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitApproxMatchFilter(final P p, final String attributeDescription, |
| | | final ByteString assertionValue) { |
| | | return visitDefaultFilter(p); |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitEqualityMatchFilter(final P p, final String attributeDescription, |
| | | final ByteString assertionValue) { |
| | | return visitDefaultFilter(p); |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitExtensibleMatchFilter(final P p, final String matchingRule, |
| | | final String attributeDescription, final ByteString assertionValue, |
| | | final boolean dnAttributes) { |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitGreaterOrEqualFilter(final P p, final String attributeDescription, |
| | | final ByteString assertionValue) { |
| | | return visitDefaultFilter(p); |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitLessOrEqualFilter(final P p, final String attributeDescription, |
| | | final ByteString assertionValue) { |
| | | return visitDefaultFilter(p); |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitNotFilter(final P p, final Filter subFilter) { |
| | | return visitDefaultFilter(p); |
| | | } |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitOrFilter(final P p, final List<Filter> subFilters) { |
| | | return visitDefaultFilter(p); |
| | | } |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitPresentFilter(final P p, final String attributeDescription) { |
| | | return visitDefaultFilter(p); |
| | | } |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitSubstringsFilter(final P p, final String attributeDescription, |
| | | final ByteString initialSubstring, final List<ByteString> anySubstrings, |
| | | final ByteString finalSubstring) { |
| | |
| | | * <p> |
| | | * The default implementation is to call {@link #visitDefaultFilter(Object)}. |
| | | */ |
| | | @Override |
| | | public R visitUnrecognizedFilter(final P p, final byte filterTag, final ByteString filterBytes) { |
| | | return visitDefaultFilter(p); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | * @throws NullPointerException |
| | | * If {@code value} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean add(ByteString value); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code values} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean addAll(Collection<? extends ByteString> values); |
| | | |
| | | /** |
| | |
| | | * If this attribute does not support removal of attribute |
| | | * values. |
| | | */ |
| | | @Override |
| | | void clear(); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code value} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean contains(Object value); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code values} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean containsAll(Collection<?> values); |
| | | |
| | | /** |
| | |
| | | * @return {@code true} if {@code object} is an attribute which is equal to |
| | | * this attribute, or {@code false} if not. |
| | | */ |
| | | @Override |
| | | boolean equals(Object object); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The hash code for this attribute. |
| | | */ |
| | | @Override |
| | | int hashCode(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return {@code true} if this attribute contains no attribute values. |
| | | */ |
| | | @Override |
| | | boolean isEmpty(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return An iterator over the attribute values in this attribute. |
| | | */ |
| | | @Override |
| | | Iterator<ByteString> iterator(); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code value} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean remove(Object value); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code values} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean removeAll(Collection<?> values); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code values} was {@code null}. |
| | | */ |
| | | @Override |
| | | boolean retainAll(Collection<?> values); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The number of attribute values in this attribute. |
| | | */ |
| | | @Override |
| | | int size(); |
| | | |
| | | /** |
| | |
| | | * @return An array containing all of the attribute values contained in this |
| | | * attribute. |
| | | */ |
| | | @Override |
| | | ByteString[] toArray(); |
| | | |
| | | /** |
| | |
| | | * @throws NullPointerException |
| | | * If {@code array} was {@code null}. |
| | | */ |
| | | @Override |
| | | <T> T[] toArray(T[] array); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The string representation of this attribute. |
| | | */ |
| | | @Override |
| | | String toString(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2015 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | public abstract boolean isSuperTypeOf(Impl other); |
| | | |
| | | public abstract int size(); |
| | | |
| | | } |
| | | |
| | | private static final class MultiOptionImpl extends Impl { |
| | |
| | | return false; |
| | | } else { |
| | | // Check this contains other's options. |
| | | // |
| | | // This could be optimized more if required, but it's probably |
| | | // not worth it. |
| | | // This could be optimized more if required, but it's probably not worth it. |
| | | final MultiOptionImpl tmp = (MultiOptionImpl) other; |
| | | for (final String normalizedOption : tmp.normalizedOptions) { |
| | | if (!hasOption(normalizedOption)) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Iterator<String> iterator() { |
| | | return Iterators.arrayIterator(options); |
| | | } |
| | |
| | | return other.hasOption(normalizedOption); |
| | | } |
| | | |
| | | @Override |
| | | public Iterator<String> iterator() { |
| | | return Iterators.singletonIterator(option); |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Iterator<String> iterator() { |
| | | return Iterators.emptyIterator(); |
| | | } |
| | |
| | | private static final ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>> CACHE = |
| | | new ThreadLocal<WeakHashMap<Schema, Map<String, AttributeDescription>>>() { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected WeakHashMap<Schema, Map<String, AttributeDescription>> initialValue() { |
| | | return new WeakHashMap<>(); |
| | |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | @Override |
| | | public int compareTo(final AttributeDescription other) { |
| | | final int result = attributeType.compareTo(other.attributeType); |
| | | if (result != 0) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | this.isFatal = isFatal; |
| | | } |
| | | |
| | | /** |
| | | * Returns the message that explains the problem that occurred. |
| | | * |
| | | * @return LocalizableMessage of the problem |
| | | */ |
| | | @Override |
| | | public LocalizableMessage getMessageObject() { |
| | | return message; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | this.schema = schema; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Schema resolveSchema(final String dn) { |
| | | return schema; |
| | | } |
| | | |
| | | } |
| | | |
| | | private SchemaResolver schemaResolver; |
| | | |
| | | private EntryFactory entryFactory; |
| | | |
| | | private AttributeFactory attributeFactory; |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | * @return {@code true} if {@code object} is an entry which is equal to this |
| | | * entry, or {@code false} if not. |
| | | */ |
| | | @Override |
| | | boolean equals(Object object); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The hash code for this entry. |
| | | */ |
| | | @Override |
| | | int hashCode(); |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return The string representation of this entry. |
| | | */ |
| | | @Override |
| | | String toString(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | |
| | | private static final Function<ByteString, String, NeverThrowsException> BYTESTRING_TO_STRING = |
| | | new Function<ByteString, String, NeverThrowsException>() { |
| | | @Override |
| | | public String apply(final ByteString value) { |
| | | return value.toString(); |
| | | } |
| | |
| | | |
| | | private static final Function<Object, Object, NeverThrowsException> IDENTITY = |
| | | new Function<Object, Object, NeverThrowsException>() { |
| | | @Override |
| | | public Object apply(final Object value) { |
| | | return value; |
| | | } |
| | |
| | | |
| | | private static final Function<String, String, NeverThrowsException> NORMALIZE_STRING = |
| | | new Function<String, String, NeverThrowsException>() { |
| | | @Override |
| | | public String apply(final String value) { |
| | | return StaticUtils.toLowerCase(value).trim(); |
| | | } |
| | |
| | | |
| | | private static final Function<Object, ByteString, NeverThrowsException> OBJECT_TO_BYTESTRING = |
| | | new Function<Object, ByteString, NeverThrowsException>() { |
| | | @Override |
| | | public ByteString apply(final Object value) { |
| | | return ByteString.valueOfObject(value); |
| | | } |
| | |
| | | |
| | | private static final Function<String, Boolean, NeverThrowsException> STRING_TO_BOOLEAN = |
| | | new Function<String, Boolean, NeverThrowsException>() { |
| | | @Override |
| | | public Boolean apply(final String value) { |
| | | final String valueString = StaticUtils.toLowerCase(value); |
| | | if ("true".equals(valueString) || "yes".equals(valueString) |
| | |
| | | |
| | | private static final Function<String, GeneralizedTime, NeverThrowsException> STRING_TO_GENERALIZED_TIME = |
| | | new Function<String, GeneralizedTime, NeverThrowsException>() { |
| | | @Override |
| | | public GeneralizedTime apply(final String value) { |
| | | return GeneralizedTime.valueOf(value); |
| | | } |
| | |
| | | |
| | | private static final Function<String, Integer, NeverThrowsException> STRING_TO_INTEGER = |
| | | new Function<String, Integer, NeverThrowsException>() { |
| | | @Override |
| | | public Integer apply(final String value) { |
| | | try { |
| | | return Integer.valueOf(value); |
| | |
| | | |
| | | private static final Function<String, Long, NeverThrowsException> STRING_TO_LONG = |
| | | new Function<String, Long, NeverThrowsException>() { |
| | | @Override |
| | | public Long apply(final String value) { |
| | | try { |
| | | return Long.valueOf(value); |
| | |
| | | public static <M, X, N> Function<M, N, NeverThrowsException> compose( |
| | | final Function<M, X, NeverThrowsException> first, final Function<X, N, NeverThrowsException> second) { |
| | | return new Function<M, N, NeverThrowsException>() { |
| | | @Override |
| | | public N apply(final M value) { |
| | | return second.apply(first.apply(value)); |
| | | } |
| | |
| | | public static Function<String, AttributeDescription, NeverThrowsException> stringToAttributeDescription( |
| | | final Schema schema) { |
| | | return new Function<String, AttributeDescription, NeverThrowsException>() { |
| | | @Override |
| | | public AttributeDescription apply(final String value) { |
| | | return AttributeDescription.valueOf(value, schema); |
| | | } |
| | |
| | | */ |
| | | public static Function<String, DN, NeverThrowsException> stringToDN(final Schema schema) { |
| | | return new Function<String, DN, NeverThrowsException>() { |
| | | @Override |
| | | public DN apply(final String value) { |
| | | return DN.valueOf(value, schema); |
| | | } |
| | |
| | | public static Function<ByteString, AttributeDescription, NeverThrowsException> byteStringToAttributeDescription( |
| | | final Schema schema) { |
| | | return compose(byteStringToString(), new Function<String, AttributeDescription, NeverThrowsException>() { |
| | | @Override |
| | | public AttributeDescription apply(final String value) { |
| | | return AttributeDescription.valueOf(value, schema); |
| | | } |
| | |
| | | */ |
| | | public static Function<ByteString, DN, NeverThrowsException> byteStringToDN(final Schema schema) { |
| | | return compose(byteStringToString(), new Function<String, DN, NeverThrowsException>() { |
| | | @Override |
| | | public DN apply(final String value) { |
| | | return DN.valueOf(value, schema); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | | * This class contains methods for creating common types of key manager. |
| | | */ |
| | | /** This class contains methods for creating common types of key manager. */ |
| | | public final class KeyManagers { |
| | | /** |
| | | * This class implements an X.509 key manager that will be used to wrap an |
| | |
| | | this.alias = alias; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String chooseClientAlias(final String[] keyType, final Principal[] issuers, |
| | | final Socket socket) { |
| | | for (final String type : keyType) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String chooseEngineClientAlias(final String[] keyType, final Principal[] issuers, |
| | | final SSLEngine engine) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String chooseEngineServerAlias(final String keyType, final Principal[] issuers, |
| | | final SSLEngine engine) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String chooseServerAlias(final String keyType, final Principal[] issuers, |
| | | final Socket socket) { |
| | | final String[] serverAliases = keyManager.getServerAliases(keyType, issuers); |
| | |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getCertificateChain(final String alias) { |
| | | return keyManager.getCertificateChain(alias); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String[] getClientAliases(final String keyType, final Principal[] issuers) { |
| | | return keyManager.getClientAliases(keyType, issuers); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public PrivateKey getPrivateKey(final String alias) { |
| | | return keyManager.getPrivateKey(alias); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String[] getServerAliases(final String keyType, final Principal[] issuers) { |
| | | return keyManager.getServerAliases(keyType, issuers); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | * An entry factory which can be used to create new linked hash map entries. |
| | | */ |
| | | public static final EntryFactory FACTORY = new EntryFactory() { |
| | | @Override |
| | | public Entry newEntry(final DN name) { |
| | | return new LinkedHashMapEntry(name); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | * A visitor which is used to transform a filter into a matcher. |
| | | */ |
| | | private static final class Visitor implements FilterVisitor<MatcherImpl, Schema> { |
| | | @Override |
| | | public MatcherImpl visitAndFilter(final Schema schema, final List<Filter> subFilters) { |
| | | if (subFilters.isEmpty()) { |
| | | logger.trace(LocalizableMessage.raw("Empty add filter component. Will always return TRUE")); |
| | |
| | | return new AndMatcherImpl(subMatchers); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitApproxMatchFilter(final Schema schema, |
| | | final String attributeDescription, final ByteString assertionValue) { |
| | | final AttributeDescription ad; |
| | |
| | | return new AssertionMatcherImpl(ad, rule, null, assertion, false); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitEqualityMatchFilter(final Schema schema, |
| | | final String attributeDescription, final ByteString assertionValue) { |
| | | final AttributeDescription ad; |
| | |
| | | return new AssertionMatcherImpl(ad, rule, null, assertion, false); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitExtensibleMatchFilter(final Schema schema, |
| | | final String matchingRule, final String attributeDescription, |
| | | final ByteString assertionValue, final boolean dnAttributes) { |
| | |
| | | return new AssertionMatcherImpl(ad, rule, ruleUse, assertion, dnAttributes); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitGreaterOrEqualFilter(final Schema schema, |
| | | final String attributeDescription, final ByteString assertionValue) { |
| | | final AttributeDescription ad; |
| | |
| | | return new AssertionMatcherImpl(ad, rule, null, assertion, false); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitLessOrEqualFilter(final Schema schema, |
| | | final String attributeDescription, final ByteString assertionValue) { |
| | | final AttributeDescription ad; |
| | |
| | | return new AssertionMatcherImpl(ad, rule, null, assertion, false); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitNotFilter(final Schema schema, final Filter subFilter) { |
| | | final MatcherImpl subMatcher = subFilter.accept(this, schema); |
| | | return new NotMatcherImpl(subMatcher); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitOrFilter(final Schema schema, final List<Filter> subFilters) { |
| | | if (subFilters.isEmpty()) { |
| | | logger.trace(LocalizableMessage.raw("Empty or filter component. Will always return FALSE")); |
| | |
| | | return new OrMatcherImpl(subMatchers); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitPresentFilter(final Schema schema, final String attributeDescription) { |
| | | AttributeDescription ad; |
| | | try { |
| | |
| | | return new PresentMatcherImpl(ad); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitSubstringsFilter(final Schema schema, |
| | | final String attributeDescription, final ByteString initialSubstring, |
| | | final List<ByteString> anySubstrings, final ByteString finalSubstring) { |
| | |
| | | return new AssertionMatcherImpl(ad, rule, null, assertion, false); |
| | | } |
| | | |
| | | @Override |
| | | public MatcherImpl visitUnrecognizedFilter(final Schema schema, final byte filterTag, |
| | | final ByteString filterBytes) { |
| | | // TODO: I18N |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | * returned by {@link Schema#getDefaultSchema()}. |
| | | */ |
| | | SchemaResolver DEFAULT = new SchemaResolver() { |
| | | |
| | | @Override |
| | | public Schema resolveSchema(String dn) { |
| | | return Schema.getDefaultSchema(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | |
| | | this.comparators = comparators; |
| | | } |
| | | |
| | | @Override |
| | | public int compare(final Entry entry1, final Entry entry2) { |
| | | for (final Comparator<Entry> comparator : comparators) { |
| | | final int result = comparator.compare(entry1, entry2); |
| | |
| | | * We must use the lowest available value in both entries and missing |
| | | * attributes sort last. |
| | | */ |
| | | @Override |
| | | public int compare(final Entry entry1, final Entry entry2) { |
| | | // Find and normalize the lowest value attribute in each entry. |
| | | final ByteString normalizedValue1 = lowestValueOf(entry1); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | |
| | | * An entry factory which can be used to create new tree map entries. |
| | | */ |
| | | public static final EntryFactory FACTORY = new EntryFactory() { |
| | | @Override |
| | | public Entry newEntry(final DN name) { |
| | | return new TreeMapEntry(name); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | | import java.io.File; |
| | |
| | | import org.forgerock.opendj.ldap.schema.Schema; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | /** |
| | | * This class contains methods for creating common types of trust manager. |
| | | */ |
| | | /** This class contains methods for creating common types of trust manager. */ |
| | | public final class TrustManagers { |
| | | |
| | | /** |
| | |
| | | this.hostNamePattern = hostNamePattern; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | verifyHostName(chain); |
| | | trustManager.checkClientTrusted(chain, authType); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | verifyHostName(chain); |
| | | trustManager.checkServerTrusted(chain, authType); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return trustManager.getAcceptedIssuers(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * An X509TrustManager which rejects certificates which have expired or are |
| | | * not yet valid. |
| | | */ |
| | | /** An X509TrustManager which rejects certificates which have expired or are not yet valid. */ |
| | | private static final class CheckValidityDates implements X509TrustManager { |
| | | |
| | | private final X509TrustManager trustManager; |
| | |
| | | this.trustManager = trustManager; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | verifyExpiration(chain); |
| | | trustManager.checkClientTrusted(chain, authType); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | verifyExpiration(chain); |
| | | trustManager.checkServerTrusted(chain, authType); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return trustManager.getAcceptedIssuers(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * An X509TrustManager which does not trust any certificates. |
| | | */ |
| | | /** An X509TrustManager which does not trust any certificates. */ |
| | | private static final class DistrustAll implements X509TrustManager { |
| | | /** Single instance. */ |
| | | private static final DistrustAll INSTANCE = new DistrustAll(); |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | throw new CertificateException(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | throw new CertificateException(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return new X509Certificate[0]; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * An X509TrustManager which trusts all certificates. |
| | | */ |
| | | /** An X509TrustManager which trusts all certificates. */ |
| | | private static final class TrustAll implements X509TrustManager { |
| | | |
| | | /** Single instance. */ |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkClientTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void checkServerTrusted(final X509Certificate[] chain, final String authType) |
| | | throws CertificateException { |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() { |
| | | return new X509Certificate[0]; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2013 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.controls; |
| | |
| | | * Directory Access Protocol (LDAP) Assertion Control </a> |
| | | */ |
| | | public final class AssertionRequestControl implements Control { |
| | | /** |
| | | * The IANA-assigned OID for the LDAP assertion request control. |
| | | */ |
| | | /** The IANA-assigned OID for the LDAP assertion request control. */ |
| | | public static final String OID = "1.3.6.1.1.12"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the LDAP assertion request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the LDAP assertion request control. */ |
| | | public static final ControlDecoder<AssertionRequestControl> DECODER = |
| | | new ControlDecoder<AssertionRequestControl>() { |
| | | |
| | | @Override |
| | | public AssertionRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return filter; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * Directory Access Protocol (LDAP) "Who am I?" Operation </a> |
| | | */ |
| | | public final class AuthorizationIdentityRequestControl implements Control { |
| | | /** |
| | | * The OID for the authorization identity request control. |
| | | */ |
| | | /** The OID for the authorization identity request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.16"; |
| | | |
| | | private final boolean isCritical; |
| | |
| | | private static final AuthorizationIdentityRequestControl NONCRITICAL_INSTANCE = |
| | | new AuthorizationIdentityRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the authorization identity |
| | | * request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the authorization identity request control. */ |
| | | public static final ControlDecoder<AuthorizationIdentityRequestControl> DECODER = |
| | | new ControlDecoder<AuthorizationIdentityRequestControl>() { |
| | | |
| | | @Override |
| | | public AuthorizationIdentityRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | */ |
| | | public final class AuthorizationIdentityResponseControl implements Control { |
| | | |
| | | /** |
| | | * The OID for the authorization identity response control. |
| | | */ |
| | | /** The OID for the authorization identity response control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.15"; |
| | | |
| | | /** |
| | |
| | | |
| | | private final boolean isCritical; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the authorization identity |
| | | * response control. |
| | | */ |
| | | /** A decoder which can be used for decoding the authorization identity response control. */ |
| | | public static final ControlDecoder<AuthorizationIdentityResponseControl> DECODER = |
| | | new ControlDecoder<AuthorizationIdentityResponseControl>() { |
| | | |
| | | @Override |
| | | public AuthorizationIdentityResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return new AuthorizationIdentityResponseControl(control.isCritical(), authID); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return authorizationID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return ByteString.valueOfUtf8(authorizationID); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | public static final ControlDecoder<EntryChangeNotificationResponseControl> DECODER = |
| | | new ControlDecoder<EntryChangeNotificationResponseControl>() { |
| | | |
| | | @Override |
| | | public EntryChangeNotificationResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control, options); |
| | |
| | | changeType, previousDN, changeNumber); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | this.value = value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return oid; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return value; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return value != null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * @see <a |
| | | * href="http://tools.ietf.org/html/draft-ietf-ldapext-acl-model">draft-ietf-ldapext-acl-model |
| | | * - Access Control Model for LDAPv3 </a> |
| | | **/ |
| | | public final class GetEffectiveRightsRequestControl implements Control { |
| | | /** |
| | | * The OID for the get effective rights request control. |
| | | */ |
| | | public final class GetEffectiveRightsRequestControl implements Control { |
| | | /** The OID for the get effective rights request control. */ |
| | | public static final String OID = "1.3.6.1.4.1.42.2.27.9.5.2"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the get effective rights request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the get effective rights request control. */ |
| | | public static final ControlDecoder<GetEffectiveRightsRequestControl> DECODER = |
| | | new ControlDecoder<GetEffectiveRightsRequestControl>() { |
| | | |
| | | @Override |
| | | public GetEffectiveRightsRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return authorizationName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return authorizationName != null || !attributes.isEmpty(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * Directories </a> |
| | | */ |
| | | public final class ManageDsaITRequestControl implements Control { |
| | | /** |
| | | * The OID for the ManageDsaIT request control. |
| | | */ |
| | | /** The OID for the ManageDsaIT request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.2"; |
| | | |
| | | private static final ManageDsaITRequestControl CRITICAL_INSTANCE = |
| | |
| | | private static final ManageDsaITRequestControl NONCRITICAL_INSTANCE = |
| | | new ManageDsaITRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the Manage DsaIT request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the Manage DsaIT request control. */ |
| | | public static final ControlDecoder<ManageDsaITRequestControl> DECODER = |
| | | new ControlDecoder<ManageDsaITRequestControl>() { |
| | | |
| | | @Override |
| | | public ManageDsaITRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * (LDAPv3) </a> |
| | | */ |
| | | public final class MatchedValuesRequestControl implements Control { |
| | | /** |
| | | * Visitor for validating matched values filters. |
| | | */ |
| | | /** Visitor for validating matched values filters. */ |
| | | private static final class FilterValidator extends |
| | | AbstractFilterVisitor<LocalizedIllegalArgumentException, Filter> { |
| | | |
| | |
| | | */ |
| | | public static final String OID = "1.2.826.0.1.3344810.2.3"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the matched values request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the matched values request control. */ |
| | | public static final ControlDecoder<MatchedValuesRequestControl> DECODER = |
| | | new ControlDecoder<MatchedValuesRequestControl>() { |
| | | |
| | | @Override |
| | | public MatchedValuesRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return filters; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * - Password Policy for LDAP Directories </a> |
| | | */ |
| | | public final class PasswordExpiredResponseControl implements Control { |
| | | /** |
| | | * The OID for the Netscape password expired response control. |
| | | */ |
| | | /** The OID for the Netscape password expired response control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.4"; |
| | | |
| | | private final boolean isCritical; |
| | |
| | | private static final PasswordExpiredResponseControl NONCRITICAL_INSTANCE = |
| | | new PasswordExpiredResponseControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the password expired response |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the password expired response control. */ |
| | | public static final ControlDecoder<PasswordExpiredResponseControl> DECODER = |
| | | new ControlDecoder<PasswordExpiredResponseControl>() { |
| | | |
| | | @Override |
| | | public PasswordExpiredResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return CONTROL_VALUE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013-2015 ForgeRock AS |
| | | * Portions copyright 2013-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | public final class PasswordExpiringResponseControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the Netscape password expiring response control. |
| | | */ |
| | | /** The OID for the Netscape password expiring response control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.5"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the password expiring response |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the password expiring response control. */ |
| | | public static final ControlDecoder<PasswordExpiringResponseControl> DECODER = |
| | | new ControlDecoder<PasswordExpiringResponseControl>() { |
| | | |
| | | @Override |
| | | public PasswordExpiringResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | secondsUntilExpiration); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.secondsUntilExpiration = secondsUntilExpiration; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return secondsUntilExpiration; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return ByteString.valueOfUtf8(String.valueOf(secondsUntilExpiration)); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * </a> |
| | | */ |
| | | public final class PasswordPolicyRequestControl implements Control { |
| | | /** |
| | | * The OID for the password policy control from |
| | | * draft-behera-ldap-password-policy. |
| | | */ |
| | | /** The OID for the password policy control from draft-behera-ldap-password-policy. */ |
| | | public static final String OID = "1.3.6.1.4.1.42.2.27.8.5.1"; |
| | | |
| | | private final boolean isCritical; |
| | |
| | | private static final PasswordPolicyRequestControl NONCRITICAL_INSTANCE = |
| | | new PasswordPolicyRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the password policy request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the password policy request control. */ |
| | | public static final ControlDecoder<PasswordPolicyRequestControl> DECODER = |
| | | new ControlDecoder<PasswordPolicyRequestControl>() { |
| | | |
| | | @Override |
| | | public PasswordPolicyRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | 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. |
| | | */ |
| | | /** The OID for the password policy control from draft-behera-ldap-password-policy. */ |
| | | public static final String OID = PasswordPolicyRequestControl.OID; |
| | | |
| | | private final int warningValue; |
| | |
| | | |
| | | private final PasswordPolicyWarningType warningType; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the password policy response |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the password policy response control. */ |
| | | public static final ControlDecoder<PasswordPolicyResponseControl> DECODER = |
| | | new ControlDecoder<PasswordPolicyResponseControl>() { |
| | | |
| | | @Override |
| | | public PasswordPolicyResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | |
| | | private final boolean isCritical; |
| | | |
| | | /** |
| | | * The BER type value for the warning element of the control value. |
| | | */ |
| | | /** The BER type value for the warning element of the control value. */ |
| | | private static final byte TYPE_WARNING_ELEMENT = (byte) 0xA0; |
| | | |
| | | /** |
| | | * The BER type value for the error element of the control value. |
| | | */ |
| | | /** The BER type value for the error element of the control value. */ |
| | | private static final byte TYPE_ERROR_ELEMENT = (byte) 0x81; |
| | | |
| | | private PasswordPolicyResponseControl(final boolean isCritical, |
| | |
| | | return errorType; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | return warningValue; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * </pre> |
| | | */ |
| | | public final class PermissiveModifyRequestControl implements Control { |
| | | /** |
| | | * The OID for the permissive modify request control. |
| | | */ |
| | | /** The OID for the permissive modify request control. */ |
| | | public static final String OID = "1.2.840.113556.1.4.1413"; |
| | | |
| | | private static final PermissiveModifyRequestControl CRITICAL_INSTANCE = |
| | |
| | | private static final PermissiveModifyRequestControl NONCRITICAL_INSTANCE = |
| | | new PermissiveModifyRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the permissive modify request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the permissive modify request control. */ |
| | | public static final ControlDecoder<PermissiveModifyRequestControl> DECODER = |
| | | new ControlDecoder<PermissiveModifyRequestControl>() { |
| | | |
| | | @Override |
| | | public PermissiveModifyRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | public final class PersistentSearchRequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the persistent search request control. |
| | | */ |
| | | /** The OID for the persistent search request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.3"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the persistent search request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the persistent search request control. */ |
| | | public static final ControlDecoder<PersistentSearchRequestControl> DECODER = |
| | | new ControlDecoder<PersistentSearchRequestControl>() { |
| | | |
| | | @Override |
| | | public PersistentSearchRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | returnECs, Collections.unmodifiableSet(changeTypeSet)); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return changeTypes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | |
| | | return changesOnly; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | |
| | | return returnECs; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | private static final PostReadRequestControl NONCRITICAL_EMPTY_INSTANCE = |
| | | new PostReadRequestControl(false, Collections.<String> emptyList()); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the post-read request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the post-read request control. */ |
| | | public static final ControlDecoder<PostReadRequestControl> DECODER = |
| | | new ControlDecoder<PostReadRequestControl>() { |
| | | |
| | | @Override |
| | | public PostReadRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return attributes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | */ |
| | | public static final String OID = PostReadRequestControl.OID; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the post-read response control. |
| | | */ |
| | | /** A decoder which can be used for decoding the post-read response control. */ |
| | | public static final ControlDecoder<PostReadResponseControl> DECODER = |
| | | new ControlDecoder<PostReadResponseControl>() { |
| | | |
| | | @Override |
| | | public PostReadResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | .unmodifiableEntry(entry)); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return entry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | try { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | private static final PreReadRequestControl NONCRITICAL_EMPTY_INSTANCE = |
| | | new PreReadRequestControl(false, Collections.<String> emptyList()); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the pre-read request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the pre-read request control. */ |
| | | public static final ControlDecoder<PreReadRequestControl> DECODER = |
| | | new ControlDecoder<PreReadRequestControl>() { |
| | | |
| | | @Override |
| | | public PreReadRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return attributes; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | */ |
| | | public static final String OID = PreReadRequestControl.OID; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the pre-read response control. |
| | | */ |
| | | /** A decoder which can be used for decoding the pre-read response control. */ |
| | | public static final ControlDecoder<PreReadResponseControl> DECODER = |
| | | new ControlDecoder<PreReadResponseControl>() { |
| | | |
| | | @Override |
| | | public PreReadResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | .unmodifiableEntry(entry)); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return entry; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | try { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | public final class ProxiedAuthV1RequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the proxied authorization v1 control. |
| | | */ |
| | | /** The OID for the proxied authorization v1 control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.12"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the proxied authorization v1 |
| | | * request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the proxied authorization v1 request control. */ |
| | | public static final ControlDecoder<ProxiedAuthV1RequestControl> DECODER = |
| | | new ControlDecoder<ProxiedAuthV1RequestControl>() { |
| | | |
| | | @Override |
| | | public ProxiedAuthV1RequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return new ProxiedAuthV1RequestControl(authorizationDN); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return authorizationName; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder buffer = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | public final class ProxiedAuthV2RequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the proxied authorization v2 control. |
| | | */ |
| | | /** The OID for the proxied authorization v2 control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.18"; |
| | | |
| | | private static final ProxiedAuthV2RequestControl ANONYMOUS = |
| | | new ProxiedAuthV2RequestControl(""); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the proxied authorization v2 |
| | | * request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the proxied authorization v2 request control. */ |
| | | public static final ControlDecoder<ProxiedAuthV2RequestControl> DECODER = |
| | | new ControlDecoder<ProxiedAuthV2RequestControl>() { |
| | | |
| | | @Override |
| | | public ProxiedAuthV2RequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return new ProxiedAuthV2RequestControl(authorizationID); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return authorizationID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return ByteString.valueOfUtf8(authorizationID); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * Extension for Server Side Sorting of Search Results </a> |
| | | */ |
| | | public final class ServerSideSortRequestControl implements Control { |
| | | /** |
| | | * The OID for the server-side sort request control. |
| | | */ |
| | | /** The OID for the server-side sort request control. */ |
| | | public static final String OID = "1.2.840.113556.1.4.473"; |
| | | |
| | | /** |
| | | * The BER type to use when encoding the orderingRule element. |
| | | */ |
| | | /** The BER type to use when encoding the orderingRule element. */ |
| | | private static final byte TYPE_ORDERING_RULE_ID = (byte) 0x80; |
| | | |
| | | /** |
| | | * The BER type to use when encoding the reverseOrder element. |
| | | */ |
| | | /** The BER type to use when encoding the reverseOrder element. */ |
| | | private static final byte TYPE_REVERSE_ORDER = (byte) 0x81; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the server side sort request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the server side sort request control. */ |
| | | public static final ControlDecoder<ServerSideSortRequestControl> DECODER = |
| | | new ControlDecoder<ServerSideSortRequestControl>() { |
| | | |
| | | @Override |
| | | public ServerSideSortRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.sortKeys = keys; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return sortKeys; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder buffer = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * Extension for Server Side Sorting of Search Results </a> |
| | | */ |
| | | public final class ServerSideSortResponseControl implements Control { |
| | | /** |
| | | * The OID for the server-side sort response control. |
| | | */ |
| | | /** The OID for the server-side sort response control. */ |
| | | public static final String OID = "1.2.840.113556.1.4.474"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the server side sort response |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the server side sort response control. */ |
| | | public static final ControlDecoder<ServerSideSortResponseControl> DECODER = |
| | | new ControlDecoder<ServerSideSortResponseControl>() { |
| | | |
| | | @Override |
| | | public ServerSideSortResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control, options); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * The BER type to use when encoding the attribute type element. |
| | | */ |
| | | /** The BER type to use when encoding the attribute type element. */ |
| | | private static final byte TYPE_ATTRIBUTE_TYPE = (byte) 0x80; |
| | | |
| | | /** |
| | |
| | | return attributeDescription; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | 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. |
| | | */ |
| | | /** The OID for the paged results request/response control defined in RFC 2696. */ |
| | | public static final String OID = "1.2.840.113556.1.4.319"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the simple paged results |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the simple paged results control. */ |
| | | public static final ControlDecoder<SimplePagedResultsControl> DECODER = |
| | | new ControlDecoder<SimplePagedResultsControl>() { |
| | | |
| | | @Override |
| | | public SimplePagedResultsControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return new SimplePagedResultsControl(control.isCritical(), size, cookie); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | */ |
| | | private final int size; |
| | | |
| | | /** |
| | | * The control value cookie element. |
| | | */ |
| | | /** The control value cookie element. */ |
| | | private final ByteString cookie; |
| | | |
| | | private final boolean isCritical; |
| | |
| | | return cookie; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return size; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | public final class SubentriesRequestControl implements Control { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | /** |
| | | * The OID for the sub-entries request control. |
| | | */ |
| | | /** The OID for the sub-entries request control. */ |
| | | public static final String OID = "1.3.6.1.4.1.4203.1.10.1"; |
| | | |
| | | private static final SubentriesRequestControl CRITICAL_VISIBLE_INSTANCE = |
| | |
| | | private static final SubentriesRequestControl NONCRITICAL_INVISIBLE_INSTANCE = |
| | | new SubentriesRequestControl(false, false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the sub-entries request control. |
| | | */ |
| | | /** A decoder which can be used for decoding the sub-entries request control. */ |
| | | public static final ControlDecoder<SubentriesRequestControl> DECODER = |
| | | new ControlDecoder<SubentriesRequestControl>() { |
| | | |
| | | @Override |
| | | public SubentriesRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return newControl(control.isCritical(), visibility); |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.visibility = visibility; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | return visibility; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * - Tree Delete Control </a> |
| | | */ |
| | | public final class SubtreeDeleteRequestControl implements Control { |
| | | /** |
| | | * The OID for the subtree delete request control. |
| | | */ |
| | | /** The OID for the subtree delete request control. */ |
| | | public static final String OID = "1.2.840.113556.1.4.805"; |
| | | |
| | | private static final SubtreeDeleteRequestControl CRITICAL_INSTANCE = |
| | |
| | | private static final SubtreeDeleteRequestControl NONCRITICAL_INSTANCE = |
| | | new SubtreeDeleteRequestControl(false); |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the sub-tree delete request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the sub-tree delete request control. */ |
| | | public static final ControlDecoder<SubtreeDeleteRequestControl> DECODER = |
| | | new ControlDecoder<SubtreeDeleteRequestControl>() { |
| | | |
| | | @Override |
| | | public SubtreeDeleteRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | this.isCritical = isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | return null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * Browsing of Search Results </a> |
| | | */ |
| | | public final class VirtualListViewRequestControl implements Control { |
| | | /** |
| | | * The OID for the virtual list view request control. |
| | | */ |
| | | /** The OID for the virtual list view request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.9"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the virtual list view request |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the virtual list view request control. */ |
| | | public static final ControlDecoder<VirtualListViewRequestControl> DECODER = |
| | | new ControlDecoder<VirtualListViewRequestControl>() { |
| | | |
| | | @Override |
| | | public VirtualListViewRequestControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | }; |
| | | |
| | | /** |
| | | * The BER type to use when encoding the byOffset target element. |
| | | */ |
| | | /** The BER type to use when encoding the byOffset target element. */ |
| | | private static final byte TYPE_TARGET_BYOFFSET = (byte) 0xA0; |
| | | |
| | | /** |
| | | * The BER type to use when encoding the greaterThanOrEqual target element. |
| | | */ |
| | | /** The BER type to use when encoding the greaterThanOrEqual target element. */ |
| | | private static final byte TYPE_TARGET_GREATERTHANOREQUAL = (byte) 0x81; |
| | | |
| | | /** |
| | |
| | | return offset; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | return assertionValue == null; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.controls; |
| | | |
| | |
| | | * Browsing of Search Results </a> |
| | | */ |
| | | public final class VirtualListViewResponseControl implements Control { |
| | | /** |
| | | * The OID for the virtual list view request control. |
| | | */ |
| | | /** The OID for the virtual list view request control. */ |
| | | public static final String OID = "2.16.840.1.113730.3.4.10"; |
| | | |
| | | /** |
| | | * A decoder which can be used for decoding the virtual list view response |
| | | * control. |
| | | */ |
| | | /** A decoder which can be used for decoding the virtual list view response control. */ |
| | | public static final ControlDecoder<VirtualListViewResponseControl> DECODER = |
| | | new ControlDecoder<VirtualListViewResponseControl>() { |
| | | |
| | | @Override |
| | | public VirtualListViewResponseControl decodeControl(final Control control, |
| | | final DecodeOptions options) throws DecodeException { |
| | | Reject.ifNull(control); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return contextID; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getOID() { |
| | | return OID; |
| | | } |
| | |
| | | return targetPosition; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getValue() { |
| | | final ByteStringBuilder buffer = new ByteStringBuilder(); |
| | | final ASN1Writer writer = ASN1.getWriter(buffer); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean hasValue() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isCritical() { |
| | | return isCritical; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder builder = new StringBuilder(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public String getApproximateMatchingRule() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String getEqualityMatchingRule() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String getOrderingMatchingRule() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public String getSubstringMatchingRule() { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isBEREncodingRequired() { |
| | | return false; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2015 ForgeRock AS. |
| | | * Portions copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | * @throws NullPointerException |
| | | * If {@code name} was {@code null}. |
| | | */ |
| | | @Override |
| | | public int compareTo(final AttributeType type) { |
| | | if (isObjectClassType) { |
| | | return type.isObjectClassType ? 0 : -1; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; |
| | |
| | | return EMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_BINARY_NAME; |
| | | } |
| | |
| | | return OMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // All values will be acceptable for the binary syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_BIT_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_BIT_STRING_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String valueString = value.toString().toUpperCase(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_BOOLEAN_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_BOOLEAN_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String valueString = value.toString().toUpperCase(); |
| | |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 Manuel Gaupp |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | */ |
| | | final class CertificateExactAssertionSyntaxImpl extends AbstractSyntaxImpl { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_CERTIFICATE_EXACT_ASSERTION_NAME; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isBEREncodingRequired() { |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // This method will never be called because this syntax is only used |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_CERTLIST_NAME; |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // All values will be acceptable for the certificate list syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_CERTPAIR_NAME; |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // All values will be acceptable for the certificate pair syntax. |
| | |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 Manuel Gaupp |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_COUNTRY_STRING_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String stringValue = value.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2015 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return EMR_OID_FIRST_COMPONENT_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_DIT_CONTENT_RULE_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We'll use the decodeDITContentRule method to determine if the |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_DELIVERY_METHOD_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String stringValue = toLowerCase(value.toString()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | SchemaUtils.normalizeStringAttributeValue(assertionValue, TRIM, CASE_FOLD)); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) |
| | | throws DecodeException { |
| | | final String definition = value.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_DIRECTORY_STRING_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | if (value.length() > 0 || schema.getOption(ALLOW_ZERO_LENGTH_DIRECTORY_STRINGS)) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2015 ForgeRock AS. |
| | | * Portions copyright 2011-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_DN_NAME); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) |
| | | throws DecodeException { |
| | | try { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_DN_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_DN_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | try { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(AMR_DOUBLE_METAPHONE_NAME); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | String valueString = value.toString(); |
| | | final int length = valueString.length(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.toLowerCase; |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return oid; |
| | | } |
| | |
| | | return entries.indexOf(normalize(value)); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // The value is acceptable if it belongs to the set. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_FAXNUMBER_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Get a lowercase string representation of the value and find its |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_FAX_NAME; |
| | | } |
| | |
| | | return OMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // All values will be acceptable for the fax syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_GENERALIZED_TIME_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { |
| | | return normalizeAttributeValue(value); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_GENERALIZED_TIME_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { |
| | | return GeneralizedTimeEqualityMatchingRuleImpl.normalizeAttributeValue(value); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_GENERALIZED_TIME_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_GENERALIZED_TIME_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | try { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import static com.forgerock.opendj.util.StaticUtils.toLowerCase; |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_IA5_STRING_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We will allow any value that does not contain any non-ASCII |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2013-2015 ForgeRock AS |
| | | * Portions copyright 2013-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { |
| | | final String definition = value.toString(); |
| | | final SubstringReader reader = new SubstringReader(definition); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_INTEGER_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_INTEGER_NAME; |
| | | } |
| | |
| | | return SMR_CASE_EXACT_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String valueString = value.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS |
| | | * Portions Copyright 2012-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | final String normalStr = normalize(assertionValue); |
| | | |
| | | return new Assertion() { |
| | | @Override |
| | | public ConditionResult matches(final ByteSequence attributeValue) { |
| | | // See if the assertion value is contained in the attribute |
| | | // value. If not, then it isn't a match. |
| | |
| | | return Collections.emptySet(); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return ByteString.valueOfUtf8(normalize(value)); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_UNIQUE_MEMBER_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_NAME_AND_OPTIONAL_UID_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String valueString = value.toString().trim(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2014 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return EMR_OID_FIRST_COMPONENT_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_NAME_FORM_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We'll use the decodeNameForm method to determine if the value is |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_NUMERIC_STRING_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return SchemaUtils.normalizeNumericStringAttributeValue(value); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_NUMERIC_STRING_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return SchemaUtils.normalizeNumericStringAttributeValue(value); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(SMR_NUMERIC_STRING_NAME, EMR_NUMERIC_STRING_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return SchemaUtils.normalizeNumericStringAttributeValue(value); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_NUMERIC_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_NUMERIC_STRING_NAME; |
| | | } |
| | |
| | | return SMR_CASE_EXACT_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String valueString = value.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_OID_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_OID_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | try { |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_OCTET_STRING_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return value.toByteString(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2015 ForgeRock AS. |
| | | * Portions copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_OCTET_STRING_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return value.toByteString(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(SMR_OCTET_STRING_NAME, EMR_OCTET_STRING_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | return value.toByteString(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_OCTET_STRING_NAME; |
| | | } |
| | |
| | | return OMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // All values will be acceptable for the octet string syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_LIST_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_OTHER_MAILBOX_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_LIST_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Check to see if the provided value was null. If so, then that's |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_POSTAL_ADDRESS_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We'll allow any value. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_PRESENTATION_ADDRESS_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We will accept any value for this syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_PRINTABLE_STRING_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Check to see if the provided value was null. If so, then that's |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_PROTOCOL_INFORMATION_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We will accept any value for this syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return "Regex(" + pattern + ")"; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | final String strValue = value.toString(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | | import org.forgerock.i18n.LocalizableException; |
| | |
| | | this.message = message; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getMessageObject() { |
| | | return this.message; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_SUBSTRING_ASSERTION_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Get the string representation of the value and check its length. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_OCTET_STRING_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_SUPPORTED_ALGORITHM_NAME; |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // All values will be acceptable for the supported algorithm syntax. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_TELEPHONE_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | final String valueString = value.toString(); |
| | | final int valueLength = valueString.length(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(SMR_TELEPHONE_NAME, EMR_TELEPHONE_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { |
| | | final String valueString = value.toString(); |
| | | final int valueLength = valueString.length(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2011 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_TELEPHONE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_TELEPHONE_NAME; |
| | | } |
| | |
| | | return SMR_TELEPHONE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // No matter what, the value can't be empty or null. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_TELETEX_TERM_ID_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Get a lowercase string representation of the value and find its |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_TELEX_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Get a string representation of the value and find its length. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2014 ForgeRock AS |
| | | * Portions copyright 2012-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | return EMR_GENERALIZED_TIME_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_UTC_TIME_NAME; |
| | | } |
| | |
| | | return SMR_CASE_IGNORE_OID; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // Get the value as a string and verify that it is at least long |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | * and ordering matching will be allowed by default. |
| | | */ |
| | | final class UUIDSyntaxImpl extends AbstractSyntaxImpl { |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_UUID_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the provided value is acceptable for use in an |
| | | * attribute with this syntax. If it is not, then the reason may be appended |
| | | * to the provided buffer. |
| | | * |
| | | * @param schema |
| | | * The schema in which this syntax is defined. |
| | | * @param value |
| | | * The value for which to make the determination. |
| | | * @param invalidReason |
| | | * The buffer to which the invalid reason should be appended. |
| | | * @return <CODE>true</CODE> if the provided value is acceptable for use |
| | | * with this syntax, or <CODE>false</CODE> if not. |
| | | */ |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We will only accept values that look like valid UUIDs. This means |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_UNIQUE_MEMBER_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { |
| | | // Separate value into normalized DN and "optional uid" portion. |
| | | final String stringValue = value.toString().trim(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | super(EMR_USER_PASSWORD_EXACT_NAME); |
| | | } |
| | | |
| | | @Override |
| | | public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) |
| | | throws DecodeException { |
| | | // The normalized form of this matching rule is exactly equal to the |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | return EMR_USER_PASSWORD_EXACT_OID; |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return SYNTAX_USER_PASSWORD_NAME; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isHumanReadable() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, |
| | | final LocalizableMessageBuilder invalidReason) { |
| | | // We have to accept any value here because in many cases the value |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.spi; |
| | |
| | | this.timestamp = System.currentTimeMillis(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public final boolean handleIntermediateResponse(final IntermediateResponse response) { |
| | | // FIXME: there's a potential race condition here - the promise could |
| | |
| | | * |
| | | * @return String representation of this promise's state. |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | final StringBuilder sb = new StringBuilder(); |
| | | sb.append("( requestID = "); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS |
| | | * Portions copyright 2012-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.DecodeException; |
| | | import org.forgerock.opendj.ldap.DecodeOptions; |
| | | import org.forgerock.opendj.ldap.controls.Control; |
| | | import org.forgerock.opendj.ldap.controls.ControlDecoder; |
| | | import org.forgerock.opendj.ldap.requests.Request; |
| | | |
| | | /** |
| | |
| | | * If {@code dn} was {@code null}. |
| | | */ |
| | | // ChangeRecord setName(String dn); |
| | | |
| | | /** {@inheritDoc} */ |
| | | Request addControl(Control control); |
| | | |
| | | /** {@inheritDoc} */ |
| | | <C extends Control> C getControl(ControlDecoder<C> decoder, DecodeOptions options) |
| | | throws DecodeException; |
| | | |
| | | /** {@inheritDoc} */ |
| | | List<Control> getControls(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | |
| | | // Nothing to do. |
| | | } |
| | | |
| | | @Override |
| | | public IOException visitChangeRecord(final ChangeRecordWriter p, final AddRequest change) { |
| | | try { |
| | | p.writeChangeRecord(change); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IOException visitChangeRecord(final ChangeRecordWriter p, final DeleteRequest change) { |
| | | try { |
| | | p.writeChangeRecord(change); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyDNRequest change) { |
| | | try { |
| | | p.writeChangeRecord(change); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyRequest change) { |
| | | try { |
| | | p.writeChangeRecord(change); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | |
| | | * @throws IOException |
| | | * If an unexpected IO error occurred while closing. |
| | | */ |
| | | @Override |
| | | void close() throws IOException; |
| | | |
| | | /** |
| | |
| | | * @throws IOException |
| | | * If an unexpected IO error occurred while flushing. |
| | | */ |
| | | @Override |
| | | void flush() throws IOException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | |
| | | * connection. Closing a previously closed change record writer has no |
| | | * effect. |
| | | */ |
| | | @Override |
| | | public void close() { |
| | | connection.close(); |
| | | } |
| | |
| | | * Connection change record writers do not require flushing, so this method |
| | | * has no effect. |
| | | */ |
| | | @Override |
| | | public void flush() { |
| | | // Do nothing. |
| | | } |
| | |
| | | * @throws NullPointerException |
| | | * If {@code change} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change) throws LdapException { |
| | | Reject.ifNull(change); |
| | | connection.add(change); |
| | |
| | | * @throws NullPointerException |
| | | * If {@code change} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionChangeRecordWriter writeChangeRecord(final ChangeRecord change) throws LdapException { |
| | | Reject.ifNull(change); |
| | | |
| | |
| | | * @throws NullPointerException |
| | | * If {@code change} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionChangeRecordWriter writeChangeRecord(final DeleteRequest change) throws LdapException { |
| | | Reject.ifNull(change); |
| | | connection.delete(change); |
| | |
| | | * @throws NullPointerException |
| | | * If {@code change} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionChangeRecordWriter writeChangeRecord(final ModifyDNRequest change) throws LdapException { |
| | | Reject.ifNull(change); |
| | | connection.modifyDN(change); |
| | |
| | | * @throws NullPointerException |
| | | * If {@code change} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionChangeRecordWriter writeChangeRecord(final ModifyRequest change) throws LdapException { |
| | | Reject.ifNull(change); |
| | | connection.modify(change); |
| | |
| | | * @throws NullPointerException |
| | | * If {@code comment} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionChangeRecordWriter writeComment(final CharSequence comment) { |
| | | Reject.ifNull(comment); |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | |
| | | * Closes this connection entry writer, including the underlying connection. |
| | | * Closing a previously closed entry writer has no effect. |
| | | */ |
| | | @Override |
| | | public void close() { |
| | | connection.close(); |
| | | } |
| | |
| | | * Connection entry writers do not require flushing, so this method has no |
| | | * effect. |
| | | */ |
| | | @Override |
| | | public void flush() { |
| | | // Do nothing. |
| | | } |
| | |
| | | * @throws NullPointerException |
| | | * If {@code comment} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionEntryWriter writeComment(final CharSequence comment) { |
| | | Reject.ifNull(comment); |
| | | |
| | |
| | | * @throws NullPointerException |
| | | * If {@code entry} was {@code null}. |
| | | */ |
| | | @Override |
| | | public ConnectionEntryWriter writeEntry(final Entry entry) throws LdapException { |
| | | Reject.ifNull(entry); |
| | | connection.add(entry); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | |
| | | * @throws IOException |
| | | * If an unexpected IO error occurred while closing. |
| | | */ |
| | | @Override |
| | | void close() throws IOException; |
| | | |
| | | /** |
| | |
| | | * @throws IOException |
| | | * If an unexpected IO error occurred while flushing. |
| | | */ |
| | | @Override |
| | | void flush() throws IOException; |
| | | |
| | | /** |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2011-2015 ForgeRock AS |
| | | * Copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | |
| | | private static final class EntryIteratorReader implements EntryReader { |
| | | private final Iterator<Entry> iterator; |
| | | private EntryIteratorReader(final Iterator<Entry> iterator) { this.iterator = iterator; } |
| | | @Override |
| | | public void close() { } |
| | | @Override |
| | | public boolean hasNext() { return iterator.hasNext(); } |
| | | @Override |
| | | public Entry readEntry() { return iterator.next(); } |
| | | } |
| | | // @formatter:on |
| | |
| | | * Comparator ordering the DN ASC. |
| | | */ |
| | | private static final Comparator<byte[][]> DN_ORDER2 = new Comparator<byte[][]>() { |
| | | @Override |
| | | public int compare(byte[][] b1, byte[][] b2) { |
| | | return DN_ORDER.compare(b1[0], b2[0]); |
| | | } |
| | |
| | | * Comparator ordering the DN ASC. |
| | | */ |
| | | private static final Comparator<byte[]> DN_ORDER = new Comparator<byte[]>() { |
| | | @Override |
| | | public int compare(byte[] b1, byte[] b2) { |
| | | final ByteString bs = ByteString.valueOfBytes(b1); |
| | | final ByteString bs2 = ByteString.valueOfBytes(b2); |
| | |
| | | private Entry nextEntry = null; |
| | | private int entryCount = 0; |
| | | |
| | | @Override |
| | | public void close() throws IOException { |
| | | input.close(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasNext() throws IOException { |
| | | if (nextEntry == null) { |
| | | final int sizeLimit = search.getSizeLimit(); |
| | |
| | | return nextEntry != null; |
| | | } |
| | | |
| | | @Override |
| | | public Entry readEntry() throws IOException { |
| | | if (hasNext()) { |
| | | final Entry entry = nextEntry; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | | |
| | | import java.io.IOException; |
| | |
| | | super(writer); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void close() throws IOException { |
| | | close0(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void flush() throws IOException { |
| | | flush0(); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDIFEntryWriter writeComment(final CharSequence comment) throws IOException { |
| | | writeComment0(comment); |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LDIFEntryWriter writeEntry(final Entry entry) throws IOException { |
| | | Reject.ifNull(entry); |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2011 ForgeRock AS |
| | | * Copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldif; |
| | |
| | | */ |
| | | RejectedChangeRecordListener FAIL_FAST = new RejectedChangeRecordListener() { |
| | | |
| | | @Override |
| | | public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry) throws DecodeException { |
| | | throw DecodeException.error(REJECTED_CHANGE_FAIL_ADD_DUPE.get(change.getName())); |
| | | } |
| | | |
| | | @Override |
| | | public Entry handleDuplicateEntry(final ModifyDNRequest change, final Entry existingEntry, |
| | | final Entry renamedEntry) throws DecodeException { |
| | | throw DecodeException.error(REJECTED_CHANGE_FAIL_MODIFYDN_DUPE.get(renamedEntry.getName())); |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(final AddRequest change, final LocalizableMessage reason) |
| | | throws DecodeException { |
| | | throw DecodeException.error(reason); |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(final DeleteRequest change, final LocalizableMessage reason) |
| | | throws DecodeException { |
| | | throw DecodeException.error(reason); |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(final ModifyRequest change, final LocalizableMessage reason) |
| | | throws DecodeException { |
| | | throw DecodeException.error(reason); |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(final ModifyDNRequest change, final LocalizableMessage reason) |
| | | throws DecodeException { |
| | | throw DecodeException.error(reason); |
| | |
| | | */ |
| | | RejectedChangeRecordListener OVERWRITE = new RejectedChangeRecordListener() { |
| | | |
| | | @Override |
| | | public Entry handleDuplicateEntry(final AddRequest change, final Entry existingEntry) throws DecodeException { |
| | | // Overwrite existing entries. |
| | | return change; |
| | | } |
| | | |
| | | @Override |
| | | public Entry handleDuplicateEntry(final ModifyDNRequest change, final Entry existingEntry, |
| | | final Entry renamedEntry) throws DecodeException { |
| | | // Overwrite existing entries. |
| | | return renamedEntry; |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(AddRequest change, LocalizableMessage reason) throws DecodeException { |
| | | // Ignore. |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(DeleteRequest change, LocalizableMessage reason) |
| | | throws DecodeException { |
| | | // Ignore. |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(ModifyRequest change, LocalizableMessage reason) |
| | | throws DecodeException { |
| | | // Ignore. |
| | | } |
| | | |
| | | @Override |
| | | public void handleRejectedChangeRecord(ModifyDNRequest change, LocalizableMessage reason) |
| | | throws DecodeException { |
| | | // Ignore. |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | * Portions copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.requests; |
| | |
| | | }; |
| | | } |
| | | |
| | | @Override |
| | | @Test(enabled = false) |
| | | public void testBindClient(BindRequest request) throws Exception { |
| | | // Should setup a test krb server... |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.requests; |
| | |
| | | |
| | | /** Dummy decoder which does nothing. */ |
| | | private static class MyDecoder implements ControlDecoder<Control> { |
| | | @Override |
| | | public Control decodeControl(final Control control, final DecodeOptions options) throws DecodeException { |
| | | // do nothing. |
| | | return control; |
| | | } |
| | | |
| | | @Override |
| | | public String getOID() { |
| | | return "1.2.3".intern(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Copyright 2015 ForgeRock AS. |
| | | * Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "equalsTestData") |
| | | public Object[][] createEqualsTestData() throws SchemaException, DecodeException { |
| | | return new Object[][] { |
| | |
| | | Assert.assertFalse(builder.toSchema().getWarnings().isEmpty()); |
| | | } |
| | | |
| | | @Override |
| | | protected SchemaElement getElement(final String description, |
| | | final Map<String, List<String>> extraProperties) throws SchemaException { |
| | | final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema()); |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | @SuppressWarnings("javadoc") |
| | | public class CaseIgnoreIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | | @DataProvider(name = "substringInvalidAssertionValues") |
| | | public Object[][] createMatchingRuleInvalidAssertionValues() { |
| | | return new Object[][] { { "12345678\uFFFD", new String[0], null }, |
| | |
| | | { null, strings(), "12345678\uFFFD" }, }; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "substringInvalidAttributeValues") |
| | | public Object[][] createMatchingRuleInvalidAttributeValues() { |
| | | return new Object[][] { { "12345678\uFFFD" }, }; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | @SuppressWarnings("javadoc") |
| | | public class CaseIgnoreSubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | | @DataProvider(name = "substringInvalidAssertionValues") |
| | | public Object[][] createMatchingRuleInvalidAssertionValues() { |
| | | return new Object[][] {}; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "substringInvalidAttributeValues") |
| | | public Object[][] createMatchingRuleInvalidAttributeValues() { |
| | | return new Object[][] {}; |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | @Test |
| | | public class CollationSubstringMatchingRuleTest extends SubstringMatchingRuleTest { |
| | | |
| | | @Override |
| | | @DataProvider(name = "substringInvalidAssertionValues") |
| | | public Object[][] createMatchingRuleInvalidAssertionValues() { |
| | | return new Object[][] { }; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "substringInvalidAttributeValues") |
| | | public Object[][] createMatchingRuleInvalidAttributeValues() { |
| | | return new Object[][] { }; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2013-2015 ForgeRock AS. |
| | | * Portions copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.ldap.schema; |
| | |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class DistinguishedNameEqualityMatchingRuleTest extends MatchingRuleTest { |
| | | @Override |
| | | @DataProvider(name = "matchingRuleInvalidAttributeValues") |
| | | public Object[][] createMatchingRuleInvalidAttributeValues() { |
| | | return new Object[][] { { "manager" }, { "manager " }, |
| | |
| | | { "cn=,dc=example,dc=com" } }; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "matchingrules") |
| | | public Object[][] createMatchingRuleTest() { |
| | | return new Object[][] { |
| | |
| | | { "O=\"Sue, Grabbit and Runn\",C=US", "c=us\u0000o=sue\u002C grabbit and runn" }, }; |
| | | } |
| | | |
| | | @Override |
| | | protected MatchingRule getRule() { |
| | | return CoreSchema.getDistinguishedNameMatchingRule(); |
| | | } |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | * Portions Copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | private EntryResolver newResolver(final Entry e) { |
| | | return new EntryResolver() { |
| | | |
| | | @Override |
| | | public Entry getEntry(final DN dn) throws LdapException { |
| | | if (e == null) { |
| | | throw newLdapException(ResultCode.NO_SUCH_OBJECT, "no such entry " + dn); |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | }; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "matchingRuleInvalidAssertionValues") |
| | | public Object[][] createMatchingRuleInvalidAssertionValues() { |
| | | return new Object[][] { |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | }; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "matchingRuleInvalidAssertionValues") |
| | | public Object[][] createMatchingRuleInvalidAssertionValues() { |
| | | return new Object[][] { |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2014-2015 ForgeRock AS. |
| | | * Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.schema; |
| | | |
| | |
| | | }; |
| | | } |
| | | |
| | | @Override |
| | | @DataProvider(name = "matchingRuleInvalidAssertionValues") |
| | | public Object[][] createMatchingRuleInvalidAssertionValues() { |
| | | return new Object[][] { |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Copyright 2013-2014 ForgeRock AS. |
| | | * Copyright 2013-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.ldap.spi; |
| | | |
| | |
| | | final ConnectionState state = new ConnectionState(); |
| | | final ConnectionEventListener listener1 = mock(ConnectionEventListener.class); |
| | | doAnswer(new Answer<Void>() { |
| | | @Override |
| | | public Void answer(InvocationOnMock invocation) { |
| | | state.notifyConnectionClosed(); |
| | | return null; |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.grizzly; |
| | | |
| | |
| | | private int readLimit; |
| | | private int bytesRead; |
| | | |
| | | @Override |
| | | public void checkLimit(final int readSize) throws IOException { |
| | | if (0 < readLimit && readLimit < bytesRead + readSize) { |
| | | final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get(); |
| | |
| | | bytesRead += readSize; |
| | | } |
| | | |
| | | @Override |
| | | public SequenceLimiter endSequence() throws IOException { |
| | | parent.checkLimit(remaining()); |
| | | if (remaining() > 0) { |
| | |
| | | return parent; |
| | | } |
| | | |
| | | @Override |
| | | public int remaining() { |
| | | return readLimit - bytesRead; |
| | | } |
| | | |
| | | @Override |
| | | public ChildSequenceLimiter startSequence(final int readLimit) { |
| | | if (child == null) { |
| | | child = new ChildSequenceLimiter(); |
| | |
| | | private final class RootSequenceLimiter implements SequenceLimiter { |
| | | private ChildSequenceLimiter child; |
| | | |
| | | @Override |
| | | public void checkLimit(final int readSize) throws IOException { |
| | | if (buffer.remaining() < readSize) { |
| | | final LocalizableMessage message = ERR_ASN1_TRUNCATED_LENGTH_BYTE.get(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ChildSequenceLimiter endSequence() throws DecodeException { |
| | | final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED.get(); |
| | | throw new IllegalStateException(message.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public int remaining() { |
| | | return buffer.remaining(); |
| | | } |
| | | |
| | | @Override |
| | | public ChildSequenceLimiter startSequence(final int readLimit) { |
| | | if (child == null) { |
| | | child = new ChildSequenceLimiter(); |
| | |
| | | * @throws IOException |
| | | * if an I/O error occurs |
| | | */ |
| | | @Override |
| | | public void close() throws IOException { |
| | | buffer.dispose(); |
| | | } |
| | |
| | | * @throws IOException |
| | | * If an error occurs while trying to decode an ASN1 element. |
| | | */ |
| | | @Override |
| | | public boolean elementAvailable() throws IOException { |
| | | return (state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true)) |
| | | && (state != ASN1.ELEMENT_READ_STATE_NEED_FIRST_LENGTH_BYTE || needFirstLengthByteState(true)) |
| | |
| | | * @throws IOException |
| | | * If an error occurs while trying to decode an ASN1 element. |
| | | */ |
| | | @Override |
| | | public boolean hasNextElement() throws IOException { |
| | | return state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int peekLength() throws IOException { |
| | | peekType(); |
| | | |
| | |
| | | return peekLength; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public byte peekType() throws IOException { |
| | | if (state == ASN1.ELEMENT_READ_STATE_NEED_TYPE) { |
| | | needTypeState(false); |
| | |
| | | return peekType; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean readBoolean() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return readByte != 0x00; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readEndSequence() throws IOException { |
| | | readLimiter = readLimiter.endSequence(); |
| | | |
| | |
| | | state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readEndExplicitTag() throws DecodeException, IOException { |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readEndSet() throws IOException { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readEndSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int readEnumerated() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return (int) readInteger(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public long readInteger() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readNull() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString readOctetString() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return ByteString.wrap(value); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return builder; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String readOctetStringAsString() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | return str; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSequence() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartExplicitTag() throws DecodeException, IOException { |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void readStartSet() throws IOException { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | | readStartSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Reader skipElement() throws IOException { |
| | | // Read the header if haven't done so already |
| | | peekLength(); |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2012-2015 ForgeRock AS. |
| | | * Portions copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.forgerock.opendj.grizzly; |
| | | |
| | |
| | | private ChildSequenceBuffer child; |
| | | private final ByteStringBuilder buffer = new ByteStringBuilder(BUFFER_INIT_SIZE); |
| | | |
| | | @Override |
| | | public SequenceBuffer endSequence() throws IOException { |
| | | writeLength(parent, buffer.length()); |
| | | parent.writeByteArray(buffer.getBackingArray(), 0, buffer.length()); |
| | |
| | | return parent; |
| | | } |
| | | |
| | | @Override |
| | | public SequenceBuffer startSequence(final byte type) throws IOException { |
| | | if (child == null) { |
| | | child = new ChildSequenceBuffer(); |
| | |
| | | return child; |
| | | } |
| | | |
| | | @Override |
| | | public void writeByte(final byte b) throws IOException { |
| | | buffer.appendByte(b); |
| | | } |
| | | |
| | | @Override |
| | | public void writeByteArray(final byte[] bs, final int offset, final int length) throws IOException { |
| | | buffer.appendBytes(bs, offset, length); |
| | | } |
| | |
| | | private class RootSequenceBuffer implements SequenceBuffer { |
| | | private ChildSequenceBuffer child; |
| | | |
| | | @Override |
| | | public SequenceBuffer endSequence() throws IOException { |
| | | final LocalizableMessage message = ERR_ASN1_SEQUENCE_WRITE_NOT_STARTED.get(); |
| | | throw new IllegalStateException(message.toString()); |
| | | } |
| | | |
| | | @Override |
| | | public SequenceBuffer startSequence(final byte type) throws IOException { |
| | | if (child == null) { |
| | | child = new ChildSequenceBuffer(); |
| | |
| | | return child; |
| | | } |
| | | |
| | | @Override |
| | | public void writeByte(final byte b) throws IOException { |
| | | outBuffer.ensureAdditionalCapacity(1); |
| | | outBuffer.put(b); |
| | | } |
| | | |
| | | @Override |
| | | public void writeByteArray(final byte[] bs, final int offset, final int length) |
| | | throws IOException { |
| | | outBuffer.ensureAdditionalCapacity(length); |
| | |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * Initial size of newly created buffers. |
| | | */ |
| | | /** Initial size of newly created buffers. */ |
| | | private static final int BUFFER_INIT_SIZE = 1024; |
| | | |
| | | /** |
| | | * Default maximum size for cached protocol/entry encoding buffers. |
| | | */ |
| | | /** Default maximum size for cached protocol/entry encoding buffers. */ |
| | | private static final int DEFAULT_MAX_INTERNAL_BUFFER_SIZE = 32 * 1024; |
| | | |
| | | /** |
| | | * Reset the writer. |
| | | */ |
| | | /** Reset the writer. */ |
| | | void reset() { |
| | | if (!outBuffer.usable) { |
| | | // If the output buffer is unusable, create a new one. |
| | |
| | | private RecyclableBuffer outBuffer; |
| | | private final RootSequenceBuffer rootBuffer; |
| | | |
| | | /** |
| | | * Creates a new ASN.1 writer that writes to a StreamWriter. |
| | | */ |
| | | /** Creates a new ASN.1 writer that writes to a StreamWriter. */ |
| | | ASN1BufferWriter() { |
| | | this.sequenceBuffer = this.rootBuffer = new RootSequenceBuffer(); |
| | | this.outBuffer = new RecyclableBuffer(); |
| | |
| | | * @throws IOException |
| | | * if an error occurs while closing the stream. |
| | | */ |
| | | @Override |
| | | public void close() throws IOException { |
| | | outBuffer = null; |
| | | } |
| | |
| | | * @throws IOException |
| | | * If an I/O error occurs |
| | | */ |
| | | @Override |
| | | public void flush() throws IOException { |
| | | // Do nothing |
| | | } |
| | | |
| | | /** |
| | | * Recycle the writer to allow re-use. |
| | | */ |
| | | /** Recycle the writer to allow re-use. */ |
| | | @Override |
| | | public void recycle() { |
| | | sequenceBuffer = rootBuffer; |
| | | outBuffer.clear(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeBoolean(final byte type, final boolean booleanValue) throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | | writeLength(sequenceBuffer, 1); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeEndSequence() throws IOException { |
| | | sequenceBuffer = sequenceBuffer.endSequence(); |
| | | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeEndSet() throws IOException { |
| | | return writeEndSequence(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeEnumerated(final byte type, final int intValue) throws IOException { |
| | | return writeInteger(type, intValue); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeInteger(final byte type, final int intValue) throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | | if (((intValue < 0) && ((intValue & 0xFFFFFF80) == 0xFFFFFF80)) |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeInteger(final byte type, final long longValue) throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | | if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFFFF80L) == 0xFFFFFFFFFFFFFF80L)) |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeNull(final byte type) throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | | writeLength(sequenceBuffer, 0); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(final byte type, final byte[] value, final int offset, |
| | | final int length) throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(final byte type, final ByteSequence value) |
| | | throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeOctetString(final byte type, final String value) throws IOException { |
| | | sequenceBuffer.writeByte(type); |
| | | |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeStartSequence(final byte type) throws IOException { |
| | | // Get a child sequence buffer |
| | | sequenceBuffer = sequenceBuffer.startSequence(type); |
| | |
| | | return this; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ASN1Writer writeStartSet(final byte type) throws IOException { |
| | | // From an implementation point of view, a set is equivalent to a |
| | | // sequence. |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2014 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.grizzly; |
| | |
| | | setMemoryManager(memoryManager); |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return getClass().getName(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasInputRemaining(final AttributeStorage storage, final Buffer input) { |
| | | return input != null && input.hasRemaining(); |
| | | } |
| | |
| | | setMemoryManager(memoryManager); |
| | | } |
| | | |
| | | @Override |
| | | public String getName() { |
| | | return getClass().getName(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasInputRemaining(final AttributeStorage storage, final Buffer input) { |
| | | return input != null && input.hasRemaining(); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.forgerock.opendj.grizzly; |
| | |
| | | * |
| | | * @return the reader to read incoming LDAP messages |
| | | */ |
| | | @Override |
| | | public LDAPReader<ASN1BufferReader> getReader() { |
| | | return this.reader; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2014-2015 ForgeRock AS |
| | | * Portions copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | |
| | | package com.forgerock.opendj.ldap.tools; |
| | |
| | | this.lines = lines; |
| | | } |
| | | |
| | | @Override |
| | | public IDataSource duplicate() { |
| | | return new IncrementLineFileDataSource(lines); |
| | | } |
| | | |
| | | @Override |
| | | public Object getData() { |
| | | if (next == lines.size()) { |
| | | next = 0; |
| | |
| | | this.high = high; |
| | | } |
| | | |
| | | @Override |
| | | public IDataSource duplicate() { |
| | | return new IncrementNumberDataSource(low, high); |
| | | } |
| | | |
| | | @Override |
| | | public Object getData() { |
| | | if (next == high) { |
| | | next = low; |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public IDataSource duplicate() { |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public Object getData() { |
| | | return lines.get(random.nextInt(lines.size())); |
| | | } |
| | |
| | | range = high - low; |
| | | } |
| | | |
| | | @Override |
| | | public IDataSource duplicate() { |
| | | // There is no state info so threads can just share one instance. |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public Object getData() { |
| | | return random.nextInt(range) + offset; |
| | | } |
| | |
| | | this.random = new Random(seed); |
| | | } |
| | | |
| | | @Override |
| | | public IDataSource duplicate() { |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public Object getData() { |
| | | final char[] str = new char[length]; |
| | | for (int i = 0; i < length; i++) { |
| | |
| | | this.data = data; |
| | | } |
| | | |
| | | @Override |
| | | public IDataSource duplicate() { |
| | | // There is no state info so threads can just share one instance. |
| | | return this; |
| | | } |
| | | |
| | | @Override |
| | | public Object getData() { |
| | | return data; |
| | | } |